Created
May 30, 2022 20:37
-
-
Save justxor/2a76fc1848817ff76c5b20898f84aa19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_tax(price, tax): | |
return price * tax | |
def print_billing_doc(): | |
tax_rate = 0.1 | |
products = [{'name': 'Book', 'price': 30}, | |
{'name': 'Pen', 'price': 5}] | |
# print billing header | |
print(f'Name\tPrice\tTax') | |
# print the billing item | |
for product in products: | |
tax = calculate_tax(product['price'], tax_rate) | |
print(f"{product['name']}\t{product['price']}\t{tax}") | |
print(__name__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment