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 to do if your monitor is not displaying a picture
Butoxors [25]

Answer:

Refresh the page/

5 0
3 years ago
Five year ago, Amit was three times as old as Arman. Ten years later Amit would be twice as old as Arman. How old is Arman now? 
RideAnS [48]
Answer: 50
Explanation: let amit's current age = a and armaan's current age be b.
(a-5) = 3* (b-5)
i.e. a= 3b-10 -(i)
10 years later,
(a+10) = 2(b+10)
i.e. a=2b+10 -(ii)
From eqn (i) and (ii),
b=20,
and a=50
8 0
2 years ago
Read 2 more answers
Write a setInterval() function that increases the count by 1 and displays the new count in counterElement every 300 milliseconds
Alina [70]

Answer:

  1. var count = 0;
  2. var counterElement = document.getElementById("counter");
  3. counterElement.innerHTML = count;
  4. var a = setInterval(
  5.    function(){  
  6.        count++;
  7.        counterElement.innerHTML = count;
  8.        if(count == 5){
  9.            clearInterval(a);
  10.        }
  11.    }
  12.        , 300);

Explanation:

The solution code is given from Line 6 - 15.  

setInterval function is a function that will repeatedly call its inner function for an interval of time. This function will take two input, an inner function and the interval time in milliseconds.  

In this case, we define an inner function that will increment count by one (Line 8) and then display it to html page (Line 9). This inner function will repeatedly be called for 300 milliseconds. When the count reaches 5, use clearInterval to stop the innerFunction from running (Line 11 - 13).  

8 0
3 years ago
The small gear that is driven by the motor shaft of a rotisserie is called a?
Bumek [7]
The small gear that is driven by the motor shaft of a rotisserie is called a Pinion gear. A pinion gear is a type of linear actuator and comes with the rack gear. The pinion gear is the small circle running through the gear rack. It is like the wheels of the train running through the rail. So the answer to your question is letter D.
7 0
3 years ago
In order for the AutoSum function to automatically add together a row or column of cells (so that you do not have to specify the
STatiana [176]

Answer:

There are two answers: a and d

7 0
3 years ago
Other questions:
  • Processing is handled by the computer’s central processing unit (cpu).​ <br> a. True <br> b. False
    6·1 answer
  • What does an approved project summary document indicate?
    13·1 answer
  • What describes the basic transaction data such as its date, purpose, and amount and includes cash receipts, canceled checks, inv
    13·1 answer
  • What is the keyboard shortcut used to paste previously copied text?
    15·2 answers
  • Organizing speech ideas according to physical space, direction, or location calls for a _____ organizational pattern.
    11·1 answer
  • Python
    6·1 answer
  • Clasifica los documentos comerciales en activo, pasivo o patrimonial para cada operacion:
    14·1 answer
  • The identification of the technology management framework contain?
    6·1 answer
  • What does command do
    5·1 answer
  • A user generates printouts consisting of several pages of seemingly random characters every time he prints to a network printer.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!