Question
3.5 max number

We will pass in a list of numbers your job is to find the largest number in that list and outputted it’s index , not the actual value
# Get our numbers from the command line import sys 4 numbers sys.argv[1].split,) Collagse) Challenges 5 numbers int(i) for i in numbers] 3. 5. Max number # Your code goes here We will pass in a list of numbers. Your job is to find the largest number in that list and output its index, not the actual value. Tip: you will need to use a ublity variable to store the maximum value and a decision to see if each number is bigger than the current maximum value encountered in previous terations Activate Windows to Settings to activate Windows O Type here to search 5 6 8 9 2 3 4 0
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program Screenshots:

import sys numbers = sys. argv[1]. split(,). numbers = [int(i) for i in numbers] # declare and initialize variable. temp=0

Command line arguments:

Parameters: 2,3,6,4,9,7

Sample Output:

1/PycharmProjects/untitled/first.py 2,3,6,4,9,7 4

Code to Copy:

#Kindly indent the code as given in above screenshot.

# kindly use python 3.6

import sys
numbers = sys. argv[1]. split(',')
numbers = [int(i) for i in numbers]
# declare and initialize variable.
temp=0
# start the for loop
for i in range(1,len(numbers)):

    # check the condition.
   
if numbers[i]>numbers[temp]:
        # update the value.
       
temp=i
# display the result on console.
print (temp)

Add a comment
Know the answer?
Add Answer to:
3.5 max number We will pass in a list of numbers your job is to find...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Codio challenge We will pass you 2 inputs an list of numbers a number, N, to...

    Codio challenge We will pass you 2 inputs an list of numbers a number, N, to look for Your job is to loop through the list and find the number specified 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 line...

  • 3.6.x10 every other We are passing in 3 inputs A list of numbers A multiplier value,...

    3.6.x10 every other We are passing in 3 inputs A list of numbers A multiplier value, M A value, N You should multiply every Nth element ( do not multiply the 0th element)by M. So if N is 3 you start with the 3rd element which is index 2 If there are less than N elements then you should output the unchanged input list Get our input from the command line port sys İnt(sys.argv [2] ) int (sys.argv[3]) Collape) Challengs...

  • Create a program that will determine the even number(s) from a list of numbers. Your program...

    Create a program that will determine the even number(s) from a list of numbers. Your program should create and call a function FindEven that accepts a list of numbers and returns a list of only the even numbers in sorted order. Note that the original list is given in the starter code. def body(): numberlist = [1, 1000, 5, -3, 2, 16 # Write your code here and notice level # Do NOT include: if __name__ == been provided for...

  • Write a program that can: 1. Insert twenty random numbers into a linked list. The numbers...

    Write a program that can: 1. Insert twenty random numbers into a linked list. The numbers should be within a range (E.g., 1 to 7). The user should be prompted to enter the minimum number and maximum number of the range. Each number should be inserted at the end of the list. Section 7.8 of the textbook covers the random number generator. Examples of how to use the random number generator are in Fig 7.6 and 7.7. Here is a...

  • In the "Go" button add 15 random numbers in the array using a random number generator....

    In the "Go" button add 15 random numbers in the array using a random number generator. Remove the call to "SetToZero" and the code following. Remove the "SetToZero" method. Add Access Keys of your choice Assign an accept button Assign cancel button (Exit) Add a Button "Find Max" Write an appropriately named method that Accepts the array Finds the largest int and returns the value "Find Max" button click Calls above method Opens a MessageBox to display the returned value...

  • python Create a program to open a text file for reading, find the maximum number in...

    python Create a program to open a text file for reading, find the maximum number in the file, determine if that maximum number is even, and write to an output text file. You should either write Yes if the number is even, otherwise write the maximum number. You should note the following: • Your input file must be named input.txt • The input file has one integer number per line • Your output file must be named output.txt • Your...

  • IN PYTHON 3: In this version of Radix Sort we use Queues very naturally. Let us...

    IN PYTHON 3: In this version of Radix Sort we use Queues very naturally. Let us consider the following set of positive integers: 311, 96, 495, 137, 158, 84, 145, 63 We will sort these numbers with three passes. The number of passes is dependent on the number of digits of the largest number - in this case it is 495. In the first pass we will go through and sort the numbers according to the digits in the units...

  • For this assignment we are going to create the beginnings of a simple Grade Book. We...

    For this assignment we are going to create the beginnings of a simple Grade Book. We will revisit this assignment again once we learn some new concepts. For the purposes of this grade book you should first provide a menu with the following options: 1. Add a new course 2. Add a new student 3. Add a student to a course 4. Add grades for a student in a course 5. Print a list of all grades for a student...

  • 1 loop, and 1 selection Below are a list of sequences of numbers. Your job is...

    1 loop, and 1 selection Below are a list of sequences of numbers. Your job is to program each sequence with any loop of your preference (while, for, do/while). I want the code to output the sequence provided and the next number in the sequence (you can output more but there is 1 sequence that may only have 1 number after). . Each sequence should be in the same main in one .cpp file. . Please order and notate each...

  • C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) L...

    C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT