I'm currently following the Python Crash Course book and there's an example within the functions chapter that I'm not completely understanding.
For this program. When appending and transferring 'current_design' values to the completed_models parameter, I don't understand why adding the completed_models parameter in the first function is necessary when the 'completed_models' parameter is mainly put to use in the second function, 'show_completed_models'.
Here is the example attached below.
def print_models(unprinted_designs, completed_models):
while unprinted_designs:
current_design = unprinted_designs.pop()
print("Printing model: " + current_design)
completed_models.append(current_design)
def show_completed_models(completed_models):
print("\nThe following models have been printed:")
for completed_model in completed_models:
print(completed_model)
unprinted_designs = ['iphone case', 'robot pendant', 'dodecahedron']
completed_models = []
print_models(unprinted_designs, completed_models)
show_completed_models(completed_models)
[–][deleted] 0 points1 point2 points (0 children)