-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_8_McciProgram.py
More file actions
39 lines (29 loc) · 1004 Bytes
/
Copy pathPython_8_McciProgram.py
File metadata and controls
39 lines (29 loc) · 1004 Bytes
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
def preis_berechnen(gericht):
if gericht == "bigmac":
return 4.50
elif gericht == "mcflurry":
return 3.20
elif gericht == "pommes":
return 2.50
else:
return -1
try:
anzahl = int(input("Wie viele Personen bestellen? "))
gesamtpreis = 0
for i in range(anzahl):
print(f"\nBestellung {i + 1}")
name = input("Name: ")
gericht = input("Gericht (BigMac, McFlurry oder Pommes): ").lower()
preis = preis_berechnen(gericht)
if preis == -1:
print("Dieses Gericht gibt es leider nicht.")
else:
gesamtpreis += preis
print(f"{name} bestellt einen {gericht.title()} für {preis:.2f} €.")
print("\n---------------------------")
print(f"Heute haben {anzahl} Personen bestellt.")
print(f"Gesamtpreis: {gesamtpreis:.2f} €")
except ValueError:
print("Fehler: Bitte eine gültige Zahl eingeben.")
finally:
print("\nProgramm beendet. Vielen Dank!")