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]
4 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]4 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
A system administrator suspects that there is an error in the replication configuration. How can the system administrator look f
Kamila [148]

Answer:

Option D i.e., By going to Event Viewer > Directory Service Log is the correct option.

Explanation:

The following option is not false because the admin of the system assumes that there is the occurrence of the particular error message related to the replication, the main reason behind this is that the administrator firstly go the Event Viewer then, he go to the Directory Service Log. After that, a particular error message appears in the replication configuration.

7 0
3 years ago
Erica is working at a real estate office. She would like to organize the information about houses they have for sale. Erica shou
Dmitrij [34]
This is hard but for me i thinks its spreadsheet
4 0
3 years ago
Read 2 more answers
If cost of 1 kg sugar is 36 find price of 3 kg sugar​
SashulF [63]

Answer:

the answer is 108

Explanation:

3×36=108

7 0
3 years ago
Ayuda!!
emmasim [6.3K]

hola no conozco el toldo, pero necesito puntos cerebrales tan lo siento

Explanation:

8 0
3 years ago
The Android operating system was invented by ______.
EleoNora [17]

The Android operating system was invented by <u>google</u> in 2005.

4 0
3 years ago
Other questions:
  • State College charges its departments for computer time usage on the campus mainframe. A student had access to the university co
    10·1 answer
  • Which protocol is the data transmission standard for the Internet, responsible for sending information from one computer to anot
    14·1 answer
  • What part of the communication feedback loop results in unclear communication?
    13·1 answer
  • Which technology uses regular phone lines and transmits at speeds up to 256 kbps?
    15·2 answers
  • What are some of the good effects of social media
    7·1 answer
  • Tablets combine the features of which two types of devices?
    10·2 answers
  • Which of the following is not hardware? Question 7 options: A) Wireless network router B) Printer C) Virus Scanner D) Flat-panel
    11·1 answer
  • Anne creates a web page and loads a CSS style script along with the page. However, the entire page appears black and she cannot
    6·1 answer
  • Design a program using Python to subtract two numbers
    12·1 answer
  • what is required to successfully establish a connection between two routers using chap authentication?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!