-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page123.py
More file actions
62 lines (43 loc) · 1.32 KB
/
python_exercise_page123.py
File metadata and controls
62 lines (43 loc) · 1.32 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
# esercizio numero 7.4 pagina 123
prompt = "\nPlease Tell me which type of toppings you want:"
prompt += "\nEnter quit to end the program."
while True:
topping = input(prompt)
if topping == 'quit':
break
else:
print(f"Adding {topping.title()} to your pizza!")
# esercizio numero 7.5
prompt = "\nPlease tell me your age:"
prompt += "\nEnter 'quit' to end the program."
while True:
age = input(prompt)
if age == 'quit':
break
else:
age = int(age)
if age <= 3:
print("\nYour ticket is free!")
elif 3 < age <= 12:
print("\nYour ticket costs $10!")
else:
print("\nThe ticket costs $15!")
# esercizio numero 7.6 (es. 1 con punti 1 e 2.)
prompt = "\nPlease Tell me which type of toppings you want:"
prompt += "\nEnter quit to end the program."
active = True
while active:
message = input(prompt)
if message == 'quit':
active = False
else:
print(message)
# esercizio numero 7.6 (es.1 con punto numero 3.)
prompt = "\nPlease Tell me which type of toppings you want:"
prompt += "\nEnter quit to end the program."
while True:
topping = input(prompt)
if topping == 'quit':
break
else:
print(topping)