Day 03·Conditionals, loops & turning a statement into code
Lecture·1 / 27
Why this day exists
A ticket does not always have the same price. A child may pay less than an adult.
Yesterday's program performed the same calculation for every input. We need it to choose the right calculation.
We also need it to handle more than two purchases. Writing another line for every possible purchase will not work.
A small decision and a small repeated step can solve both problems. The hard part is being precise about when each step happens.
1 of 47 total|←/→ navigateEsc esc to exit