fork download
  1. main_dish = input()
  2. time_of_day = int(input())
  3.  
  4. has_voucher = input().lower() == 'yes'
  5. is_card_payment = input().lower() == 'yes'
  6.  
  7. # Determine cost based on main_dish
  8. if main_dish == "paneer tikka":
  9. cost = 250
  10. elif main_dish == "butter chicken":
  11. cost = 240
  12. elif main_dish == "masala dosa":
  13. cost = 200
  14. else:
  15. print("Invalid main dish")
  16. exit() # Exit the program if main dish is invalid
  17.  
  18. # Apply discounts based on time_of_day
  19. if 12 <= time_of_day <= 15: # Simplified comparison using chained comparison operator
  20. total_cost = (1 - 0.15) * cost # Apply 15% discount for lunch time
  21. else:
  22. total_cost = cost
  23.  
  24. # Apply voucher discount if has_voucher is True
  25. if has_voucher:
  26. total_cost *= 0.9 # Apply 10% discount if there is a voucher
  27.  
  28. # Apply service charge for card payments if is_card_payment is True
  29. if is_card_payment:
  30. service_charge = 0.05 * total_cost
  31. total_cost += service_charge # Add service charge to total cost
  32.  
  33. # Print the total cost formatted to two decimal places
  34. print(f"{total_cost:.2f}")
  35.  
Success #stdin #stdout 0.03s 9924KB
stdin
butter chicken
20
False
True
stdout
240.00