Level 2: Intermediate
def calcbilling(new_dict):
#print(new_dict)
print("---BIll Summary----")
subtotal = 0
for key,value in new_dict.items():
tot = value[0] * value[1]
print(f"{key}: {value[0]} X ${value[1]} = ${tot}")
subtotal += tot
print(f"Subtotal: ${subtotal}")
print(f"Sales Tax 5%: $0.53")
total = subtotal + 0.53
print(f"Total: {total}")
print("Thank you for Shopping with us")
if __name__ == "__main__":
print("Welcome to the Super Market Billing System")
number = int(input("Enter the number of total items: "))
new_dict = {}
for i in range(number):
print(f"Item:{i + 1}")
item_name = input("Enter the Item name: ")
item_quantity = int(input("Enter the Item Quantity: "))
item_price = float(input("Enter the Item Price: "))
new_dict.update({item_name:[item_quantity,item_price]})
calcbilling(new_dict)
def calcbilling(new_dict):
#print(new_dict)
print("---BIll Summary----")
subtotal = 0
for key,value in new_dict.items():
tot = value[0] * value[1]
print(f"{key}: {value[0]} X ${value[1]} = ${tot}")
subtotal += tot
print(f"Subtotal: ${subtotal}")
print(f"Sales Tax 5%: $0.53")
total = subtotal + 0.53
print(f"Total: {total}")
print("Thank you for Shopping with us")
if __name__ == "__main__":
print("Welcome to the Super Market Billing System")
number = int(input("Enter the number of total items: "))
new_dict = {}
for i in range(number):
print(f"Item:{i + 1}")
item_name = input("Enter the Item name: ")
item_quantity = int(input("Enter the Item Quantity: "))
item_price = float(input("Enter the Item Price: "))
new_dict.update({item_name:[item_quantity,item_price]})
#print(new_dict)
calcbilling(new_dict)