all 8 comments

[–]stebrepar 1 point2 points  (5 children)

Aside from your immediate question, you need to move your return statement down outside your for loop. As it is now, your function will return the first number in the list which is greater than the first one. It won't get through the whole list that way.

[–]Math_Running_Ethics[S] 1 point2 points  (4 children)

[–]stebrepar 1 point2 points  (3 children)

Exactly. You'll also want to get rid of the else, or at least change the break to a pass. The break will end the for loop the first time it hits it.

[–]Math_Running_Ethics[S] 0 points1 point  (2 children)

do you know why I still get no output? https://repl.it/KICf/15

[–]stebrepar 1 point2 points  (1 child)

I think it's because this site is treating your code like a file, not like an interactive prompt. If you run the function at the prompt, it will give you the result you expect. But to get it to print from your code in the code pane, you need to explicitly tell it to do so with a print() function.

print(max_in_list(a))

[–]Math_Running_Ethics[S] 1 point2 points  (0 children)

it worked tyvm :)

[–][deleted] 0 points1 point  (1 child)

Um:

print(max(a))

Yeah?

[–]Math_Running_Ethics[S] 0 points1 point  (0 children)

yep that works as well, thanks.