From the lesson: 1.2: One algorithm, three ways to write it
Each function has written steps in its comments. Turn the steps into Python.
- bus_fare uses selection: under 5 pays 0, under 16 pays 1, everyone else pays 2.
- countdown_text uses iteration: countdown_text(3) gives 3 2 1 Go!
- welcome uses sequence.
main.py
Write your answer in main.py. To try it, add a few print(...) lines at the bottom and run python3 main.py.
Read the free lesson preview, which explains the idea and lets you try its first activities. All the lessons have free previews.
There is no answer file and no test here, on purpose. On the MitsuruTech Learning Platform a teacher can set this task for a class and have it marked for them. A college account is free for the first year for up to 50 students.
Licensed under CC BY-NC-SA 4.0 by Mitsuru Technologies Ltd.