forked from codepath/compsci_guides
-
Notifications
You must be signed in to change notification settings - Fork 0
Multiplication Table
Jessica Sang edited this page Sep 14, 2024
·
1 revision
Unit 1 Session 2 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
- Will the number always be an integer?
- Yes.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop from 1 to 10, and print the result of multiplying by n
each time.
- Make sure your loop doesn't exclude the last value (10).
def multiplication_table(n):
for multiplicand in range(1, 11):
print(n * multiplicand)