You will turn three short pseudocode algorithms into Python functions. In Python, DIV is // and MOD is %.
Your tasks.
to_hours(minutes): return a pair (hours, left), using DIV(Minutes, 60) and MOD(Minutes, 60).count_down(start, stop, step): return the list of the values of FOR Number ← start TO stop STEP -step. For example, count_down(12, 2, 2) gives [12, 10, 8, 6, 4, 2].reverse_digits(number): return the number with its digits reversed, using the loop Result ← Result * 10 + MOD(Number, 10) and Number ← DIV(Number, 10).Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…