-
Notifications
You must be signed in to change notification settings - Fork 242
Counter
Sar Champagne Bielert edited this page Apr 8, 2024
·
7 revisions
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.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Create a function to count from 1 to stop
.
1) Create a new function with a parameter for the stop value
2) For each number between 1 and stop + 1, print that value
- Why would we go to "stop + 1" and not just "stop"?
def counter(stop):
for num in range(1, stop + 1):
print(num)