forked from msnow/Schmyrhon
Improve main.py and Kaufladen.py
This commit is contained in:
+25
-23
@@ -1,26 +1,28 @@
|
||||
produkt = input('Welches Produkt (Gummibaerchen, Lakritzstangen, Playstation) wünschen Sie?')
|
||||
menge = int(input('Welche Menge wünschen Sie?'))
|
||||
while True:
|
||||
produkt = input('Welches Produkt (Gummibaerchen, Lakritzstangen, Playstation) wünschen Sie? ')
|
||||
|
||||
Gummibaerchen = float(0.05)
|
||||
Lakritzstangen = float(0.30)
|
||||
Playstation = float(199.00)
|
||||
prices = {
|
||||
"Gummibaerchen": 0.05,
|
||||
"Lakritzstangen": 0.30,
|
||||
"Playstation": 199.00
|
||||
}
|
||||
|
||||
GBpreis = Gummibaerchen * menge
|
||||
LSpreis = Lakritzstangen * menge
|
||||
PSpreis = Playstation * menge
|
||||
if (not produkt in prices):
|
||||
print("Falscher Artikelname!")
|
||||
continue
|
||||
|
||||
try:
|
||||
menge = int(input('Welche Menge wünschen Sie? '))
|
||||
except:
|
||||
print("Keine gültige Menge!")
|
||||
continue
|
||||
|
||||
match produkt:
|
||||
case 'Gummibaerchen':
|
||||
print ('Netto ohne MwSt: EUR', GBpreis/1.07)
|
||||
print ('MWSt: EUR', GBpreis-GBpreis/1.07)
|
||||
print ('Zu bezahlen: EUR', GBpreis)
|
||||
case 'Lakritzstangen':
|
||||
print ('Netto ohne MwSt: EUR', LSpreis/1.07)
|
||||
print ('MWSt: EUR', LSpreis-LSpreis/1.07)
|
||||
print ('Zu bezahlen: EUR', LSpreis)
|
||||
case 'Playstation':
|
||||
print ('Netto ohne MwSt: EUR', PSpreis/1.07)
|
||||
print ('MWSt: EUR', PSpreis-PSpreis/1.07)
|
||||
print ('Zu bezahlen: EUR', PSpreis)
|
||||
case _:
|
||||
print('Falscher Artikelname!')
|
||||
total_price = prices[produkt] * menge
|
||||
netto_price = total_price / 1.07
|
||||
tax_price = total_price - total_price / 1.07
|
||||
|
||||
print (f'Netto ohne MwSt: EUR {netto_price:.2f}')
|
||||
print (f'MWSt: EUR {tax_price:.2f}')
|
||||
print (f'Zu bezahlen: EUR {total_price:.2f}')
|
||||
|
||||
break
|
||||
Reference in New Issue
Block a user