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
Uso de las redes sociales como el uso de una impresora en casa se satisfacen estás tres etapas
Svetradugi [14.3K]

Question: what question is this?

7 0
3 years ago
• R7.9 Write enhanced for loops for the following tasks.
alexdok [17]

Answer:

a is the correct answer

Explanation:

correct me if I'm wrong hope it's help thanks

3 0
3 years ago
Is “Annabelle” a true story? I mean it is fiction right?
Julli [10]
Annabelle is indeed a true story making it fiction
5 0
3 years ago
Read 2 more answers
Which formula should Gemima use to show the
Shalnov [3]
The answer is
Sum(above)
3 0
3 years ago
Read 2 more answers
Define and describe PaaS. List the benefits of PaaS solutions. Describe potential disadvantages of PaaS. Describe how a cloud-ba
Volgvan

Answer:

PaaS has become a cloud technology that offers a way for consumers just to establish, successfully manage implementations without any of the sophistication of preserving but instead developing the technology related to the development and start-up of apps.

Explanation:

<u>Benefits</u>:

  • Not no need to purchase hardware as well as raise revenues throughout leisure time.
  • There was no need to consider throughout configurations.

<u>Disadvantages</u>:

  • These have privacy concerns, during which data security contributes to the problem as well as monitored.
  • These have problems with the portability of implementation.

<u>Difference between Cloud base DBMS and On-site database</u>:

  • On-site DBMS data couldn't be accessed from just about any location as either a cloud-based management solution.
  • DBMS Cloud base documentation to ensure mostly with highly valued information collected to provide direct exposure to everybody else together whilst on-site DBMS functionalities such as SQL.

<u>Computing recourses</u>:

  • The architecture of web applications.
  • Prebuilt techniques for developing, managing, and testing applications.
6 0
3 years ago
Other questions:
  • Which of the following goals states a quantifiable outcome of a project?
    15·1 answer
  • Samantha was calculating a mathematical formula on an electronic spreadsheet. She used multiple values to recalculate the formul
    8·2 answers
  • What command prompts should be used to assign an IP address to:
    9·1 answer
  • 8. How can you prevent your VMs receiving DHCP server messages from unauthorized virtual machine pretending to be DHCP servers?
    6·1 answer
  • 2. Which the following may be a reason for giving a Page Quality (PQ) rating og Highest? Select all that apply (True or False)
    14·1 answer
  • A computer's hard disk drive holds 8 x 10^10 bytes of information. If Jill buys an extra memory stick that holds 5.1 X 10^8 byte
    10·1 answer
  • Braxton is writing a program to design t-shirts. Which of the following correctly sets an attribute for color?
    7·1 answer
  • Emanuel studies hard for hours on end until bedtime, yet his grades could be better. What can he do to improve his academic perf
    6·1 answer
  • how does the use of data abstraction manage complexity in program code? how does using lists make a program easier to develop an
    5·1 answer
  • Who was making the high-pitched growling noise that Francisco hears?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!