Python Activity:
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 utility variable to store the maximum value and a decision to see if each number is bigger than the current maximum value encountered in previous iterations.
------------------------------------------------------
Required Program Output
Program Failed for Input: 1,5,8,23,78,22,0 Expected Output: 4
------------------------------------------------------
# Get our numbers from the command line
import sys
numbers= sys.argv[1].split(',')
numbers= [int(i) for i in numbers]
# Your code goes here

Respuesta :

Answer:

Explanation:

def indexOfMax(lis):

   m = max(lis)

   indx=0

   for i in range(len(lis)):

       if lis[i]==m:

           indx=i

           break

   return indx

print(indexOfMax([1,5,8,23,78,22,0]))

Ver imagen dayanandghelaro