From 9130d1ed44c5ad1b924b1cf58d6ab49215f823c3 Mon Sep 17 00:00:00 2001 From: matteorr88 Date: Sat, 20 Apr 2024 19:20:35 +0200 Subject: [PATCH 1/2] added the solution to 007-day-old-bread --- projects/007-day-old-bread/python/main.py | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/projects/007-day-old-bread/python/main.py b/projects/007-day-old-bread/python/main.py index e69de29..29d1db3 100644 --- a/projects/007-day-old-bread/python/main.py +++ b/projects/007-day-old-bread/python/main.py @@ -0,0 +1,29 @@ +''' A bakery sells loaves of bread for €3.49 each. +Day old bread is discounted by 60 percent. + +Write a program that begins by reading the number of loaves of day-old bread being purchased from the user. +Then your program should display: +- Regular price for the bread +- Discount because it is a day old +- Total price + +Each of these amounts should be displayed on its own line with an appropriate label. +All the values should be displayed using two decimal places, +and the decimal points in all the numbers should be aligned when reasonable values are entered by the user. + +Example: +Input = 256 +Regular price: 893.44€ +Discount: 536.06€ +Total price: 357.38€ +''' +old_bread = int(input("enter the amount of day old bread loaves you're willing to purchase")) + +fresh_loaf = 3.49 +regular_price = old_bread * fresh_loaf +discount = 0.60 * regular_price +total_price = (regular_price - discount) + +print("Regular price:", format(regular_price, '.2f') + "€") +print("Discount:", format(discount, '.2f') + "€") +print("Total price:", format(total_price, '.2f') + "€") From ad0d5870b0fa1c2d76b76fd586edcf95dbe83cd1 Mon Sep 17 00:00:00 2001 From: Matteorr88 <138686253+Matteorr88@users.noreply.github.com> Date: Sat, 20 Apr 2024 19:27:55 +0200 Subject: [PATCH 2/2] deleted the comments --- projects/007-day-old-bread/python/main.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/projects/007-day-old-bread/python/main.py b/projects/007-day-old-bread/python/main.py index 29d1db3..6d818c1 100644 --- a/projects/007-day-old-bread/python/main.py +++ b/projects/007-day-old-bread/python/main.py @@ -1,22 +1,3 @@ -''' A bakery sells loaves of bread for €3.49 each. -Day old bread is discounted by 60 percent. - -Write a program that begins by reading the number of loaves of day-old bread being purchased from the user. -Then your program should display: -- Regular price for the bread -- Discount because it is a day old -- Total price - -Each of these amounts should be displayed on its own line with an appropriate label. -All the values should be displayed using two decimal places, -and the decimal points in all the numbers should be aligned when reasonable values are entered by the user. - -Example: -Input = 256 -Regular price: 893.44€ -Discount: 536.06€ -Total price: 357.38€ -''' old_bread = int(input("enter the amount of day old bread loaves you're willing to purchase")) fresh_loaf = 3.49