Skip to content

Instantly share code, notes, and snippets.

@justxor
Created May 30, 2022 20:37
Show Gist options
  • Save justxor/2a76fc1848817ff76c5b20898f84aa19 to your computer and use it in GitHub Desktop.
Save justxor/2a76fc1848817ff76c5b20898f84aa19 to your computer and use it in GitHub Desktop.
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