1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Art [367]
3 years ago
12

We will pass you 2 inputsan list of numbersa number, N, to look forYour job is to loop through the list and find the number spec

ified in the second input. Output the list element index where you find the number.If N is not found in the list, output -1.Tip: Remember the break statement? It exits the loop. You can (but don’t have to) use this.# Get our input from the command lineimport sysN= int(sys.argv[2])# Convert the list of strings into integersnumbers= []for i in sys.argv[1].split(","):if(i.isdigit()):numbers.append(int(i))# numbers now contains the list of integers# Write your code below
Computers and Technology
1 answer:
Montano1993 [528]3 years ago
4 0

Answer:

The Python code is given below

Explanation:

# Get our input from the command line

import sys

N = int(sys.argv[2])

# Convert the list of strings into integers

numbers= []

for i in sys.argv[1].split(","):

   if(i.isdigit()):

       numbers.append(int(i))

# numbers now contains the list of integers

f = False

#Use for loop upto len(numbers)

for i in range(0,len(numbers)):

   #Use "if" loop to check

   if numbers[i] == N:

       #Assign "True" to "f"

       f = True

       #Display "i"

       print(i)

       break

#Check "if" loop by assigning "false" to "f"

if f==False:

   #Print "-1"

   print("-1")

You might be interested in
Can we change our profile name on here and how
TiliK225 [7]
Only by making a new account
4 0
3 years ago
Read 2 more answers
Answer for a, b, and c
Darya [45]

The answer is a. im pretty positive but if im wrong super sorry

5 0
3 years ago
This is Microsoft Word. ONLY RIGHT ANSWERS. 50 points
pishuonlain [190]
She should select the first sentence then press and hold ALT while selecting the second sentence
5 0
2 years ago
What is the purpose of adding a footnote or an endnote in your research paper?
lions [1.4K]
They add clarifying information to a document. They provide details the reader may be unfamiliar with, and saving them from having to look them up (words, places or sources.)
3 0
3 years ago
Megapixels are used to measure which photographic element?
MakcuM [25]

Answer:

resolution of photographs it produces

Explanation:

3 0
1 year ago
Other questions:
  • What of the following google tools support collaboration
    10·1 answer
  • A _______________ is a field that contains data unique to a record.
    15·1 answer
  • During an interview, your non-verbal communication (body language, gestures, tone of voice, speed of talking,
    6·1 answer
  • A ___________ is similar to Computer Integrated Manufacturing, but is based much more on standard reusable application software
    5·1 answer
  • Often technical personnel who are not familiar with security techniques think that restricting access to ports on a router or fi
    5·1 answer
  • What is a feature of Print Preview? Fit to Document Fit to Margin Fit to Page Fit to Size
    5·2 answers
  • Why is it so important to adhere to principles that have been put forth by reputable organizations to ensure that you are mainta
    10·1 answer
  • Which statement describes what the Conditional Formatting option in Excel 2016 allows users to do?
    15·2 answers
  • What is the answer ????​
    13·2 answers
  • Take any software or Application that you have recently purchased, this can be a video game or any other application helping you
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!