From 8a9736344ca3bd680eed4fe96ae2a7428813191c Mon Sep 17 00:00:00 2001 From: Sushant Srivastav <63559772+sushant4191@users.noreply.github.com> Date: Wed, 26 Oct 2022 23:20:09 +0530 Subject: [PATCH 1/6] Calculate GST Amount The program helps to get the net amount after GST is added to it. --- financial/calculating GST.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 financial/calculating GST.py diff --git a/financial/calculating GST.py b/financial/calculating GST.py new file mode 100644 index 000000000000..d9ea3233124b --- /dev/null +++ b/financial/calculating GST.py @@ -0,0 +1,17 @@ +# The Program helps to calculate the net amount of a item when a certain percent of GST is applied. + + +def calculate(Original_price,GST_per): + GST_amount=float(((GST_per*Original_price)/100)) + Price_wGST=Original_price+GST_amount + print("Net Price after ",GST_per,"% GST is = ",Price_wGST) + + +calculate(100,25) + +''' +Enter the original Price = 100 +Enter the GST Percentage = 25 +Price after 25.0 % GST is = 125.0 + +''' From 89b97ad3af7228d6d2949b6abb7570bcd4fd639b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 26 Oct 2022 17:51:43 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- financial/calculating GST.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/financial/calculating GST.py b/financial/calculating GST.py index d9ea3233124b..714aa9676be6 100644 --- a/financial/calculating GST.py +++ b/financial/calculating GST.py @@ -1,17 +1,17 @@ # The Program helps to calculate the net amount of a item when a certain percent of GST is applied. -def calculate(Original_price,GST_per): - GST_amount=float(((GST_per*Original_price)/100)) - Price_wGST=Original_price+GST_amount - print("Net Price after ",GST_per,"% GST is = ",Price_wGST) +def calculate(Original_price, GST_per): + GST_amount = float((GST_per * Original_price) / 100) + Price_wGST = Original_price + GST_amount + print("Net Price after ", GST_per, "% GST is = ", Price_wGST) -calculate(100,25) +calculate(100, 25) -''' +""" Enter the original Price = 100 Enter the GST Percentage = 25 Price after 25.0 % GST is = 125.0 -''' +""" From 7febf4cf3604fae4a824298e3c55aa9fb4aa64b2 Mon Sep 17 00:00:00 2001 From: Sushant Srivastav <63559772+sushant4191@users.noreply.github.com> Date: Thu, 27 Oct 2022 02:26:46 +0530 Subject: [PATCH 3/6] Update financial/calculating GST.py Thanks! Co-authored-by: Christian Clauss --- financial/calculating GST.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/financial/calculating GST.py b/financial/calculating GST.py index 714aa9676be6..4ac8496810fa 100644 --- a/financial/calculating GST.py +++ b/financial/calculating GST.py @@ -1,7 +1,13 @@ # The Program helps to calculate the net amount of a item when a certain percent of GST is applied. -def calculate(Original_price, GST_per): +def price_plus_tax(price: float, tax_rate: float) -> float: + """ + >>> price_plus_tax(100, 0.25) + 125 + >>> price_plus_tax(125.50, 0.05) + 131.775 + """ GST_amount = float((GST_per * Original_price) / 100) Price_wGST = Original_price + GST_amount print("Net Price after ", GST_per, "% GST is = ", Price_wGST) From f50253289378b873af7f8b59df84c07f1e1a60bd Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 26 Oct 2022 23:08:09 +0200 Subject: [PATCH 4/6] Update and rename calculating GST.py to price_plus_tax.py --- financial/calculating GST.py | 23 ----------------------- financial/price_plus_tax.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 financial/calculating GST.py create mode 100644 financial/price_plus_tax.py diff --git a/financial/calculating GST.py b/financial/calculating GST.py deleted file mode 100644 index 4ac8496810fa..000000000000 --- a/financial/calculating GST.py +++ /dev/null @@ -1,23 +0,0 @@ -# The Program helps to calculate the net amount of a item when a certain percent of GST is applied. - - -def price_plus_tax(price: float, tax_rate: float) -> float: - """ - >>> price_plus_tax(100, 0.25) - 125 - >>> price_plus_tax(125.50, 0.05) - 131.775 - """ - GST_amount = float((GST_per * Original_price) / 100) - Price_wGST = Original_price + GST_amount - print("Net Price after ", GST_per, "% GST is = ", Price_wGST) - - -calculate(100, 25) - -""" -Enter the original Price = 100 -Enter the GST Percentage = 25 -Price after 25.0 % GST is = 125.0 - -""" diff --git a/financial/price_plus_tax.py b/financial/price_plus_tax.py new file mode 100644 index 000000000000..7323d29dee15 --- /dev/null +++ b/financial/price_plus_tax.py @@ -0,0 +1,17 @@ +""" +Calculate price plus tax of a good or service given its price and a tax rate. +""" + +def price_plus_tax(price: float, tax_rate: float) -> float: + """ + >>> price_plus_tax(100, 0.25) + 125 + >>> price_plus_tax(125.50, 0.05) + 131.775 + """ + return price * (1 + tax_rate) + + +if __name__ == "__main__": + print(f"{price_plus_tax(100, 0.25) = }") + print(f"{price_plus_tax(125.50, 0.05) = }") From 4b9fc8a49fc16a78184fc800fd160a0352458053 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 26 Oct 2022 21:10:16 +0000 Subject: [PATCH 5/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- financial/price_plus_tax.py | 1 + 1 file changed, 1 insertion(+) diff --git a/financial/price_plus_tax.py b/financial/price_plus_tax.py index 7323d29dee15..4be1117466cf 100644 --- a/financial/price_plus_tax.py +++ b/financial/price_plus_tax.py @@ -2,6 +2,7 @@ Calculate price plus tax of a good or service given its price and a tax rate. """ + def price_plus_tax(price: float, tax_rate: float) -> float: """ >>> price_plus_tax(100, 0.25) From 39beebd56b76438d39ab1379afbb8e8c98bb8fb2 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 26 Oct 2022 23:11:41 +0200 Subject: [PATCH 6/6] Update price_plus_tax.py --- financial/price_plus_tax.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/financial/price_plus_tax.py b/financial/price_plus_tax.py index 4be1117466cf..43876d35e57c 100644 --- a/financial/price_plus_tax.py +++ b/financial/price_plus_tax.py @@ -6,7 +6,7 @@ def price_plus_tax(price: float, tax_rate: float) -> float: """ >>> price_plus_tax(100, 0.25) - 125 + 125.0 >>> price_plus_tax(125.50, 0.05) 131.775 """