It's very difficult to read your code, zoom in and take a picture, or even better post your code.
Your problem is your if/elif statements. You aren't putting yes and no inside of strings, but assuming that they're variables, which they're not. You neeed to compare to strings.
Thank you, so much....You are really helpful!!!!!!
Am kind of having another small huge stuck!!!!lol
Hi, thanks for the the previous and am stuck again...
def hotel_cost(nights): return 140 * nights def plane_ride_cost(city): if city == "Charlotte": return 183 elif city == "Tampa": return 220 elif city == "Pittsburgh": return 222 elif city == "Los Angeles": return 475 else: return "select city" def rental_car_cost(days): cost = 40 * days if days >= 7: cost = 40 * days-40 elif days >= 3: cost = 40 * days-20 else: return cost
it is saying:Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (100) for 3 days.
could you give me a hand with this one? Sorry for bothering.....
if days are greater then 3, a return keyword is not reached. Just return cost at the end of your function, without
Isn't the way i put return cost at the end right?
def rental_car_cost(days): cost = 40 * days if days >= 7: cost = 40 * days -40 elif days >= 3: cost = 40 * days -20 return cost
Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days.
now a return keyword is only reached if elif is true, so now only if days are more then 3 and less then 7, what about more then 7 and less then 3?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.