We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def solve(meal_cost, tip_percent, tax_percent):
# Calculate tip amount
tip = meal_cost * (tip_percent / 100)
# Calculate tax amount
tax = meal_cost * (tax_percent / 100)
# Calculate total cost
total_cost = meal_cost + tip + tax
# Round the total cost to the nearest integer
total_cost = round(total_cost)
# Print the total cost
print(total_cost)
Day 2: Operators
You are viewing a single comment's thread. Return to all comments →
def solve(meal_cost, tip_percent, tax_percent): # Calculate tip amount tip = meal_cost * (tip_percent / 100)
Read input from stdin
meal_cost = float(input()) tip_percent = int(input()) tax_percent = int(input())
Call the solve function with input values
solve(meal_cost, tip_percent, tax_percent)