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
What is booting as used in computers?​
Sliva [168]

Answer:

the startup process

Explanation:

5 0
2 years ago
Read 2 more answers
What is the name of the mvost powerful battery
sergij07 [2.7K]
Optima battery because it is stronger than a factory battery
6 0
3 years ago
What does it mean when a return is rejected for code 0503?
GarryVolchara [31]
Reject Code 0503<span> indicates that the Spouse's Social Security Number and the first 4 letters of the spouse's last name </span>do<span> not match IRS records. The IRS uses data provided by the Social Security Administration to verify this information. Hope this helps.</span>
5 0
3 years ago
How does a paper prototype minimize constraints when compared to a digital one
aksik [14]

A regular prototype minimizes constraints if compared to a paper one because possible problems in use can be identified easily.

<h3>What is a prototype?</h3>

This refers to the initial model of a product designed to test the features of the model before it is released to the market.

<h3>What are the differences between digital and paper prototypes?</h3>

Online protoypes are often time-saving, however, because some features of the prototype cannot be tested, a regular protoype is much better to identify possible problems in design or use.

Learn more about prototipes in: brainly.com/question/4622383

#SPJ1

6 0
2 years ago
How do I convince my mom to buy a gaming computer for me? She says we already have 3 other computers/laptops in the house to use
Natalka [10]

Answer: ??

Explanation: explain to her that you don't have your own. keep asking and convince her you're doing good in school, (if u are) and that you listen and you should be responsible to have your own

4 0
2 years ago
Other questions:
  • "_____ devices improve memory by encoding items in a special way."
    13·1 answer
  • Shelly tells a friend that her computer needs to be fixed because it has been producing a lot of heat and is smoking. Where is t
    10·1 answer
  • What should a password policy contain to reduce a hackers ability to crack the passwords?
    10·1 answer
  • Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has three links, of rates R1 = 500 kbps, R2
    14·1 answer
  • Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent singl
    12·1 answer
  • Please answer my question y'all!
    6·2 answers
  • Please help!! I need this asap! thank you so much!! &lt;3
    6·1 answer
  • Which tab should be selected to add a hyperlink within a cell? Home tab Review tab Insert tab Formula tab
    12·2 answers
  • A form of segmentation that is based on user usage rate, user status, purchase occasion, and benefits sought is _________.
    13·1 answer
  • Disadvantages of a grain crusher
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!