Remember the best so far
You're looking through apartment listings for the biggest balcony. You don't write them all down: you just remember the biggest one you've seen so far, and swap it out whenever a bigger one turns up.
A loop can carry a value along in the same way. Keep one variable for "the biggest so far". At every box, compare: if this value is bigger, it becomes the new biggest. When the loop ends, it holds the answer.
Carry one value along: update it only when you beat it.
Keep the biggest so far
3
08
12
29
35
4i
best starts at 3.
Move 1 of 5
Start with a real value, not 0
What should "the biggest so far" be before you've looked at anything? Starting at 0 feels natural, but try it on −5, −2, −9. No value beats 0, so you'd return 0, a number that isn't even in the list.
Start with the first box instead. It's always a real value, and until you've seen more, it really is the biggest.
Starting at 0: breaks when every number is negative.
Start with the first box: it's always a real value.
best = nums[0]
for x in nums:
if x > best:
best = x
return best