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

Chiang picked 12 apples. She gave 1/6 of the apples to each of her 5 friends. How many apples did each friend get?
in what ways is the Holy Land an important site for all three monotheistic faiths
Fern rounded to the nearest ten to estimate 548-132. She subtracted 540-130 and got 410. Is Fern's estimate correct? Explain.
how many atoms of hydrogen are present in the reactants and in the products? 6CO2 + 6H2O → C6H12O6 + 6O2
What statement can you make about the classification of organisms using the animal tree and the plant tree
89.36 rounded to the ones place
Is 5/11 greater than 1 / 2?
what is the value of the tape diagram if the ratio is 8 to 7 and the total is 195
Chemical transmitters can stimulate any receptor site to initiate an action.
What features of Therapsids suggest the group was transitional to reptiles and mammals?