Unit 1 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
m
and n
always be positive integers?
n
ever be larger than m
?
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Create a function that takes parameters n
and m
and counts down the numbers from m
down to n
.
1) Loop through the numbers starting at `m`, ending at `n`, and stepping -1 each time
2) Print each number
⚠️ Common Mistakes
range()
to step -1 each time?def countdown(m, n):
for num in range (m, n-1, -1):
print(num)