alltimeballin alltimeballin
  • 03-01-2021
  • Computers and Technology
contestada

Finish the code to search for a 7 in the array.
from array import *
myArr = array('f',[3, 5, 7.3, 10])
location = myArr.
(7)

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 08-01-2021

Answer:

The complete code is as follows:

from array import *

myArr = array('f',[3, 5, 7,3, 10])

location = myArr.index(7)

print(str("7")+" is at position "+str(location+1))

Explanation:

I made corrections to the third line of the code and I added a line

This line gets the index of 7 from the array myArr using the index keyword

location = myArr.index(7)

This line prints the position of the 7 in the array

print(str("7")+" is at position "+str(location+1))

Answer Link

Otras preguntas

Graph the line using intercepts: 4x-3y=12
Morgan found a stone arrowhead. He measured it three times. He measured it as 2 inches to the nearest inch, to the nearest 1/2 inch, and to the nearest 1/4 inch
A number cube is rolled 24 times and lands on 2 four times and on 6 three time. Find the experimental probability of not landing on a 6
What's a good slogan for a dietitian (have dietitian in it) ?
What is a series of events that cells go through as they grow and divide
why can parents who are heterozygous for type a and type b blood have children with any of the four human blood types?
what is the simplest square root of 1345? no decimals please
a soccer team played 160 games and won 65% of them. how many did they win?
A number cube is rolled 24 times and lands on 2 four times and on 6 three time. Find the experimental probability of not landing on a 6
a soccer team played 160 games and won 65% of them. how many did they win?