From 56fe3621c27bf5c23ea001bb8ecdde9bc875787a Mon Sep 17 00:00:00 2001 From: Rsclub22 Date: Thu, 7 Apr 2022 16:16:58 +0200 Subject: [PATCH] Update 2 --- .../Getränke_automat_2.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/3. Übungen/07.04.2022/Getränke und Snack automat/Getränke_automat_2.py b/3. Übungen/07.04.2022/Getränke und Snack automat/Getränke_automat_2.py index dc7b349..e36d766 100644 --- a/3. Übungen/07.04.2022/Getränke und Snack automat/Getränke_automat_2.py +++ b/3. Übungen/07.04.2022/Getränke und Snack automat/Getränke_automat_2.py @@ -121,7 +121,7 @@ def normal_mode(): product_price=c.execute("SELECT price FROM products WHERE id=?", (int(product_id),)).fetchone()[0] # Ask the amount of the product product_amount=int(input("Bitte Anzahl des Produktes Eingeben: ")) - sum_of_price=product_price*product_amount + sum_of_price=round(product_price*product_amount,2) # Print the price of the sum print("Summe:%s€" % sum_of_price) # Ask if the user wants to continue @@ -183,6 +183,10 @@ def payment(sum_of_price): rest_cent_5=rest_cent//5 rest_cent=rest_cent-rest_cent_5*50 + # 1 Cent + rest_cent_1=rest_cent//1 + rest_cent=rest_cent-rest_cent_1*1 + if rest_euro_10 >=1: print ("Sie bekommen %smal 10€" % rest_euro_10) if rest_euro_5 >=1: @@ -192,13 +196,15 @@ def payment(sum_of_price): if rest_euro_1 >=1: print ("Sie bekommen %smal 1€" % rest_euro_1) if rest_cent_50 >=1: - print ("Sie bekommen %smal 50 Cent: %s" % rest_cent_50) + print ("Sie bekommen %smal 50 Cent:" % rest_cent_50) if rest_cent_20 >=1: - print ("Sie bekommen %smal 20 Cent: %s" % rest_cent_20) + print ("Sie bekommen %smal 20 Cent:" % rest_cent_20) if rest_cent_10 >=1: - print ("Sie bekommen %smal 10 Cent: %s" % rest_cent_10) + print ("Sie bekommen %smal 10 Cent:" % rest_cent_10) if rest_cent_5 >=1: - print ("Sie bekommen %smal 5 Cent: %s" % rest_cent_5) + print ("Sie bekommen %smal 5 Cent:" % rest_cent_5) + if rest_cent_1 >=1: + print("Sie bekommen %smal 1 Cent" % rest_cent_1) normal_mode()