At Westonci.ca, we connect you with the best answers from a community of experienced and knowledgeable individuals. Experience the convenience of getting reliable answers to your questions from a vast network of knowledgeable experts. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.

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

We hope this was helpful. Please come back whenever you need more information or answers to your queries. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Your questions are important to us at Westonci.ca. Visit again for expert answers and reliable information.