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

(NO LINKS) Please help this assignment is over due and I don't get it thxx ;)
I need this question now please
Please help me out with this!
6 marks Explain how the geology of the UK gives rise to distinctive landscapes. Refer to one or more named rock type
Reflection off of a smooth surface like a mirror is an example of diffuse reflection. true or false?
Question 2 of 20 Which region had the most cultural isolation? A. Rwanda B. New Zealand C. Somalia D. Malaysia
49. Calculate the value of c in the triangle below.
a quadratic function f(x) is graphed in the xy-coordinate plane in which wuadrant eould the vertex of f (x+3)+2
How do I say I eat breakfast at 9 am Lunch at 12 pm Dinner at 6 pm In French
The division of Earth’s history into smaller units makes up the ____.