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

which type of gas is filled in lays pack and why?
let f(x)=2x-3 and g(x)= -x^2-1 find ( g o f) (x)
You shoot an arrow set a target. The parabolic path of the arrow passes through the points shown in table. X. Y 30. 6 60. 7 100. 4 A. Find a quadratic function
Two diverging light rays, originating from the same point, have an angle of 5° between them. After the rays reflect from a plane mirror, what is the angle betwe
What are the characteristics of mass culture?
An ice cube is dropped into boiling water. How will heat flow between the water and the ice cube?
Consider two linear transformations y = T(x) and z = L(y), where T goes from R^m to R^p and L goes from R^p to R^n. Is the transformationz = L(T(x)) linear as w
which foods earthworms can digest?
write an equation that is perpendicular to the line y = 2x + 13?
let f(x)=2x-3 and g(x)= -x^2-1 find ( g o f) (x)