forked from codepath/compsci_guides
-
Notifications
You must be signed in to change notification settings - Fork 0
Print List
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.
- Can the list be empty?
- Yes. If so, your program shouldn't print anything.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through a list and print each element to the console.
def print_list(lst):
for item in lst:
print(item)