Print List - codepath/compsci_guides GitHub Wiki

Unit 1 Session 2 (Click for link to problem statements)

U-nderstand

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.

P-lan

Plan the solution with appropriate visualizations and pseudocode.

General Idea: Loop through a list and print each element to the console.

I-mplement

def print_list(lst):
	for item in lst:
		print(item)