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

Who says somtimes you dont have to be mean to hurt someones to hurt them and what does he or she meam
huge 30 points if you answer
Why is it not a good idea to store iodine in a plastic bag?
I’m confused on this one
Triangle ABC is similar to triangle XYZ. Side AB measures 2, side BC measures x + 5, side CA measures x + 7, side XY measures 4 and side YZ measures 5x – 5. Fin
What is the area of triangle ABC?
HELP ASAP PLEASE! What type of mixture can be separated using a sieve A) a homogeneous mixture with components of varying sizes B) a homogeneous mixture with c
SAS ASA SSS HL I NEED HELP SOMEONE HELP ME
Circles M and K are congruent, QR is congruent to LN and OP is congruent to VW. Find y.
evaluate the limit of lim/n->infinity 6n^2+5/3n^2