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

How do you work this problem?
What are the two largest ethnic groups in the united states today?
How do I solve c/4d divided by 3/8d
Suppose that 2 scientists use different measurement systems in their work. What problems might arise if they shared their data?
Find the original cost of a rocker selling for $159.95 at 20% off.
how to solve x to the power of 2 = 14
Which of the following did NOT grow or increase as a result of early farming? villages trade life spans cities
Explain the connection, or relationship between a protagonist and an antagonist.
Who were the British allies and how did they help them to win so many battles in the American Revolutionary
How does the saguaro cactus take advantage of rare, brief rainfall?