-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page127.py
More file actions
66 lines (41 loc) · 1.8 KB
/
python_exercise_page127.py
File metadata and controls
66 lines (41 loc) · 1.8 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# esercizio numero 7.8 pagina 127
sandwitch_orders = ['chicken sandwitch', 'egg sandwitch', 'seafood sandwitch', 'roast beef sandwitch', 'grilled beef sandwitch']
finished_sandwitches = []
while sandwitch_orders:
ended_sandwitches = sandwitch_orders.pop()
print(f"I made your {ended_sandwitches.title()}")
finished_sandwitches.append(ended_sandwitches)
print("\nThe following sandwitches have been made:")
for finished_sandwitch in finished_sandwitches:
print(finished_sandwitch.title())
print("\n")
# esercizio numero 7.9
sandwitch_orders = ['chicken sandwitch', 'pastrami', 'egg sandwitch', 'pastrami', 'seafood sandwitch', 'pastrami', 'roast beef sandwitch', 'grilled beef sandwitch']
finished_sandwitches = []
print(sandwitch_orders)
print("\n")
print("Sorry, but we ran out of pastrami!")
print("\n")
while 'pastrami' in sandwitch_orders:
sandwitch_orders.remove('pastrami')
print(sandwitch_orders)
while sandwitch_orders:
ended_sandwitches = sandwitch_orders.pop()
print(f"I made your {ended_sandwitches.title()}")
finished_sandwitches.append(ended_sandwitches)
print("\nThe following sandwitches have been made:")
for finished_sandwitch in finished_sandwitches:
print(finished_sandwitch.title())
# esercizio numero 7.10
responses ={}
polling_active = True
while polling_active:
name = input("\nWhat is your name? ")
response = input("\nIf you could visit one place in the world, what would it be? ")
responses[name] = response
repeat = input("would you like to let another person to respond? (yes/ no) ")
if repeat == 'no':
polling_active = False
print("\n--- Poll Results---")
for name, response in responses.items():
print(f"{name} would really like to go to {response}.")