Improve main.py and Kaufladen.py
This commit is contained in:
+23
-21
@@ -1,26 +1,28 @@
|
|||||||
|
while True:
|
||||||
produkt = input('Welches Produkt (Gummibaerchen, Lakritzstangen, Playstation) wünschen Sie? ')
|
produkt = input('Welches Produkt (Gummibaerchen, Lakritzstangen, Playstation) wünschen Sie? ')
|
||||||
|
|
||||||
|
prices = {
|
||||||
|
"Gummibaerchen": 0.05,
|
||||||
|
"Lakritzstangen": 0.30,
|
||||||
|
"Playstation": 199.00
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not produkt in prices):
|
||||||
|
print("Falscher Artikelname!")
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
menge = int(input('Welche Menge wünschen Sie? '))
|
menge = int(input('Welche Menge wünschen Sie? '))
|
||||||
|
except:
|
||||||
|
print("Keine gültige Menge!")
|
||||||
|
continue
|
||||||
|
|
||||||
Gummibaerchen = float(0.05)
|
total_price = prices[produkt] * menge
|
||||||
Lakritzstangen = float(0.30)
|
netto_price = total_price / 1.07
|
||||||
Playstation = float(199.00)
|
tax_price = total_price - total_price / 1.07
|
||||||
|
|
||||||
GBpreis = Gummibaerchen * menge
|
print (f'Netto ohne MwSt: EUR {netto_price:.2f}')
|
||||||
LSpreis = Lakritzstangen * menge
|
print (f'MWSt: EUR {tax_price:.2f}')
|
||||||
PSpreis = Playstation * menge
|
print (f'Zu bezahlen: EUR {total_price:.2f}')
|
||||||
|
|
||||||
match produkt:
|
break
|
||||||
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!')
|
|
||||||
@@ -21,24 +21,12 @@
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
alter = int(input ('Bitte Alter nennen'))
|
alter = int(input ('Bitte Alter nennen: '))
|
||||||
|
|
||||||
|
is_juvenile = alter >= 18 and alter <= 21
|
||||||
|
acceptable_age = 18 if is_juvenile else alter / 2 + 7
|
||||||
|
|
||||||
if alter >=22:
|
print(f"Your acceptable age is {"at least" if is_juvenile else ""} {acceptable_age}")
|
||||||
AAge = alter / 2 + 7
|
|
||||||
elif alter <=17:
|
|
||||||
AAge = alter / 2 + 7
|
|
||||||
elif alter <=21:
|
|
||||||
AAge = 18
|
|
||||||
|
|
||||||
if AAge ==18:
|
|
||||||
print("Your acceptable age is atleast", AAge)
|
|
||||||
|
|
||||||
elif AAge >=18:
|
|
||||||
print("Your acceptable age is", AAge)
|
|
||||||
|
|
||||||
elif AAge <=18:
|
|
||||||
print("Your acceptable age is", AAge)
|
|
||||||
|
|
||||||
|
|
||||||
vornamen = ['Astjan', 'Knastjan', 'Bombastjan']
|
vornamen = ['Astjan', 'Knastjan', 'Bombastjan']
|
||||||
|
|||||||
Reference in New Issue
Block a user