A "set" in python is a specific thing, but you're not using them. You should refer to these as lists instead.
This is happening because in the top-level call, the author's code always
Imagine calling
At line 9, you'll change arr with pop(0), so arr will now be
In the other function, the else clause has returns that are reached.
This is happening because in the top-level call, the author's code always
return
s while yours doesn't.Imagine calling
max_check([1,2])
. You'll enter the function and at line 5 since there are two elements in the list, you'll skip the first block. Since 1 < 2, you'll enter the second block.At line 9, you'll change arr with pop(0), so arr will now be
[2]
. Then at line 10 you'll call max_check([2])
. BUT, you don't do anything with the result of that call. Some answer comes back, and you don't capture it or return it. Instead you get to the end of the function and don't call return. Without this call, the function returns None.In the other function, the else clause has returns that are reached.