Skip to content

Commit d33f9b3

Browse files
sushant4191pre-commit-ci[bot]cclauss
authored
Calculate GST Amount (TheAlgorithms#7694)
* Calculate GST Amount The program helps to get the net amount after GST is added to it. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update financial/calculating GST.py Thanks! Co-authored-by: Christian Clauss <[email protected]> * Update and rename calculating GST.py to price_plus_tax.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update price_plus_tax.py Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <[email protected]>
1 parent 71c7c0b commit d33f9b3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

financial/price_plus_tax.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Calculate price plus tax of a good or service given its price and a tax rate.
3+
"""
4+
5+
6+
def price_plus_tax(price: float, tax_rate: float) -> float:
7+
"""
8+
>>> price_plus_tax(100, 0.25)
9+
125.0
10+
>>> price_plus_tax(125.50, 0.05)
11+
131.775
12+
"""
13+
return price * (1 + tax_rate)
14+
15+
16+
if __name__ == "__main__":
17+
print(f"{price_plus_tax(100, 0.25) = }")
18+
print(f"{price_plus_tax(125.50, 0.05) = }")

0 commit comments

Comments
 (0)