Codele / Programming basics
Find the biggest number
Five cards are face up in a row. You can look at them only one at a time, so how do you find the biggest? Keep a box for the best one so far.
- To find the biggest, keep one box for the best so far and update it.
- For every card, compare it with the box. Bigger: replace. Not bigger: keep.
- You only need to look at each card once.
- This one program uses a list, a loop, an if and a variable together.
Loading the playable lesson…