-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprinting_functions.py
More file actions
34 lines (32 loc) · 1.75 KB
/
printing_functions.py
File metadata and controls
34 lines (32 loc) · 1.75 KB
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
# Список моделей, которые необходимо напечатать.
unprinted_designs = ['iphone case', 'robot pendant', 'dodecahedron']
completed_models = []
# Цикл последовательно печатает каждую модель до конца списка.
# После печати каждая модель перемещается в список completed_models.
while unprinted_designs:
current_design = unprinted_designs.pop()
# Печать модели на 3D-принтере.
print("Printing model: " + current_design)
completed_models.append(current_design)
# Вывод всех готовых моделей.
print("\nThe following models have been printed:")
for completed_model in completed_models:
print(completed_model.title())
def print_models(unprinted_designs, completed_models):
"""Имитирует печать моделей, пока список не станет пустым.
Каждая модель после печати перемещается в completed_models.
"""
while unprinted_designs:
current_design = unprinted_designs.pop()
# Имитация печати модели на 3D-принтере.
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)