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 organisms represente are multicellular
which of the following sentences is written correct a.she filled her living room with dozens of tulips b. he needed hundreds of quilt squares for his project c.
I found this question in the Sample Assessment Material of the iGCSE Further Pure Maths. The volume of a right circular cone is increasing at the rate of 45 cm3
in what ways is Odysseus an epic hero in "the Cyclops"
To answer this question, read the following sentence: Dogs and cats filled the animal shelter, and the noise they made was incredibly loud. What is one adjecti
the vice president has blank power under the Constitution that recent vice presidents have the link power
Another term for a good ergonomic practice is body
How many Governors from California had been recalled before Davis?
(n-3)(n-5)what's the equivalent
on whose behalf did Weisel accept the Nobel Peace Prize