Print index of Max Number in a List


#1

I am trying to print the index position of the highest number in a list.

Here is the code I have so far:

aList = [2,1,5,234,3,44,7,6,4,5,9,11,12,14,13]

max = 0

for i in (aList):    
    if I  >  max:
        i  =  max + i
    
print(aList.index(i))

I do not want to print the highest number but the index of that number. Thank you.


#2

Are these homework assignments? What are these tasks? Given they are not codecademy exercise related it seemed, just to ensure that helping is okay


#3

I do not need the answer just maybe pointed in the right direction. Or if there is a lesson on here be pointed to that. Thank you.


#4

that is usually how i help, but i would like an answer to my question please. Are these home work assignments?


#5

Have you thought about what prevents you from doing that? What are you missing and how can you obtain that?
If you can manually figure out what that index is, then what’s stopping you from describing that exact same procedure in the code?

What I generally want to see in a question is something that convinces me that you can’t do it yourself and enough to tell me what exact information you need.
What I never want to see is “how do I fix this” or “what is wrong”


#6

Sorry, yes it is part of an assignment.


#7

See @ionatan reply, he makes some very good points


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.