Lesson 20: Capstone — guessing game
This is the capstone — it ties together almost everything we learned: a variable (the secret number), a list and a foreach loop (the guesses), a chain of conditions (if / else if / else), and interpolation in the output. So the program runs the same way every time and is easy to test, the guesses co
Instead of asking a live player, we hand the program a ready-made list of guesses. It goes through them one by one and tells each guess 'too high', 'too low', or 'correct!'.
- capstone
- A program that combines everything we learned: variables, lists, loops and conditions.
- deterministic
- Runs the same every time because the input is fixed (a list), not live.
- combining concepts
- Using several concepts together in one working program.