-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprinting_models.py
40 lines (33 loc) · 1.39 KB
/
printing_models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#~ # Start with some designs that need to be printed
#~ unprinted_designs = ['iphone case', 'robot pedant', 'dodecahedron']
#~ completed_models = []
#~ # Simulate printing each design, until none are lfet.
#~ # Move each design to completed_models after printing.
#~ while unprinted_designs:
#~ current_design = unprinted_designs.pop()
#~ #S Simulate creating a 3D print from the design.
#~ print("Printing model: " + current_design)
#~ completed_models.append(current_design)
#~ # Display all completed models.
#~ print("\nThe following models have been printed.")
#~ for completed_model in completed_models:
#~ print(completed_model)
def print_models(unprinted_designs, completed_models):
"""
Simulat printing each design, until non are left.
Move each design to completed_models after printing.
"""
while unprinted_designs:
current_design = unprinted_designs.pop()
# Simulate creating a 3D print from the design.
print("Printing model: " + current_design)
completed_models.append(current_design)
def show_completed_models(completed_models):
"""Show all the models that were printed."""
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)