Logo
Explore Help
Register Sign In
TheAlgorithms/Python
1
0
Fork 0
You've already forked Python
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
master
Python/financial/price_plus_tax.py

19 lines
413 B
Python
Raw Permalink Normal View History

Calculate GST Amount (#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 <cclauss@me.com> * 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 <cclauss@me.com>
2022-10-27 02:45:02 +05:30
"""
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.0
>>> 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) = }")
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 123ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API