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

what is the greatest common factors of 12 and 27
3y=15x-12 How to solve for y?
Least to greatest. 0.01;0.42;0.2;0.5
which two oceans can you see on the globe above
Why does the body switch between cellular and anaerobic respiration?
Which document was designed by the forefathers to protect a U.S. citizen's unalienable individual rights? the Federalist Papers the Declaration of Independence
How do you solve the answer to this -6(-3)(-2)
Identify the nation that exerted imperial control over India, impacting their language and religious beliefs. A. China B. Germany C. Britain D. Argentina
what do we call the transfer of goods, foods and ideas between the old world and the new world during the 1500s?
in scoole i need to know whats 14.6 divided by 2