My issue
is there anything wrong in the code
My code
def calculate_bill(**kwargs):
# Your code here
# Use **kwargs to calculate the total bill
# Don't forget to handle discount, tax, and tip
s = 0
for key in kwargs:
if key != "discount" and key != "tax" and key != "tip":
s += kwargs[key]
elif key =="discount":
s -= s*kwargs[key]/100
elif key == "tax":
s += s*kwargs[key]/100
elif key == "tip":
s += s*kwargs[key]/100
else:
s += s*10/100
s += s*15/100
return s
if __name__ == "__main__":
# Read input from stdin
input_items = input().split()
# Create a dictionary of menu items and their prices
menu_items = {}
for item in input_items:
name, price = item.split(':')
menu_items[name] = float(price)
# Call the calculate_bill function with the menu items
total = calculate_bill(**menu_items)
# Print the result
print(f"{total:.2f}")
Learning course: Python Coding Challenges
Problem Link: Customizable Restaurant Bill Calculator Practice Problem in Python Coding Challenges