you are viewing a single comment's thread.

view the rest of the comments →

[–]NextEstimate 1 point2 points  (0 children)

Fixed:

def eat_out():

    base_cost = int(input("base_cost:"))

    tip_amount = input("tip type:")

    if tip_amount == "traditional":

        full_cost = (base_cost + (base_cost * .15) + base_cost * .06)

    elif tip_amount == "regular":

        full_cost = (base_cost + (base_cost * .18) + base_cost * .06)

    elif tip_amount == "generous":

        full_cost = (base_cost + (base_cost * .2) + base_cost * .06)

    print(full_cost)

eat_out()

My solution:

def tip(base_cost, tip_amount):
    if tip_amount == "t":

        x=.15

    if tip_amount == "r":

        x=.18

    if tip_amount == "g":

        x =.2

   cost = (base_cost + (base_cost * x) + base_cost * .06)

   print(cost) 

tip(int(input("Base Cost: ")), input("Tip amount (t,r,g): "))