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

The sum of two numbers is 24. One is 6 less than twice the other. Find the two numbers.(apply polya's problem solving method)​
True/False: Standardized terminology have been developed to reflect Nutrition Screening and Outcomes Management
M is the midpoint of segment VW. Find the value of n.​
How is it possible to charge electrical devices when the power is out?
Allocation of resources is inefficient only if:________
On the map, choose the nation that expelled thousands of Muslims because of religious differences.
crusaders return to Europe from the Middle East was good that Europeans wanted so....
What three basic substances are all foods are comprised of?
what can Amendments be ratified by
which subatomic particle is responsible for naming the atom and why?