This commit is contained in:
2022-04-07 14:43:17 +02:00
parent aff8164a5c
commit c580ecc6e4
8 changed files with 266 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# Getränkeautomat
- Auswahl
- Cola (1,50€)
- Wasser (1,00€)
- Saft (2,00€)
- Anzahl
- Weiteres Getränk?
- Ja (von vorne)
- Nein (Ausgabe Preis)
- Ausgabe Preis

View File

@ -0,0 +1,45 @@
# Programm, welches einen Getränkeatuomat simuliert
weiter_machen = True
gesamtpreis = 0
preis = 0
f1 = open("cola.txt")
f2 = open("wasser.txt")
f3 = open("saft.txt")
cola = float(f1.read())
wasser= float(f2.read())
saft= float(f3.read())
while (weiter_machen==True):
#Getränkeauswahl
print("Wählen Sie ein Getränk!")
print("1. Cola %s"%(cola))
print("2. Wasser %s"%(wasser))
print("3. Saft %s"%(saft))
auswahl=int(input("Ihre Auswahl:")) # Nutzereingabe
if auswahl==1:
preis=cola
elif auswahl==2:
preis=wasser
elif auswahl==3:
preis=saft
else:
print("ERREUR, please nochmal from Vorne")
continue
# Anzahl der Getränke
anzahl=int(input("Wie viele Getränke wollen Sie? "))
preis=preis*anzahl
gesamtpreis=gesamtpreis+preis
print("Ihr Gesamtpreis beträgt %s"%(gesamtpreis)) # Gesamtpreis ausgeben
# Weiteres Getränk?
weiter=input("Möchten Sie weitere Getränke bestellen? (j/n)")
if weiter=="j":
weiter_machen=True
continue
elif weiter=="n":
break
else:
print("ERREUR, please nochmal from Vorne")
continue

View File

@ -0,0 +1 @@
1.50

View File

@ -0,0 +1 @@
2.00

View File

@ -0,0 +1 @@
1.00