Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

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)

Sagot :

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))