Do the following: Assign the values: 22, 11, 33, 55, and 44 to a 5-element list named: num_list
Write python for loop and if statement to find the highest value in the num_list and print the index/subscript number where the highest value exist.

Respuesta :

num_list = [22, 11, 33, 55, 44]

highest_number = num_list[0]

index = 0

for number in range(len(num_list)):

   if num_list[number] > highest_number:

       highest_number = num_list[number]

       index = number

print('The index of the highest value in num_list is: '+str(index))

I wrote my code in python 3.8. I hope this helps.