I have run this code in TextWrangler and got correct result. But when I run it in the codecademy editor it throws different errors every time. It is quite frustrating. Because I know it is correct but I do not have any way of skipping this stage.
Please see below a link to my exercise.
Also please see below a copy of my code.
def plane_ride_cost(city): if city=="Charlotte": return 183 elif city=="Tampa": return 220 elif city=="Pittsburgh": return 222 else: return 475 def hotel_cost(nights): return 140*nights def rental_car_cost(days): if days>=7: return 40*days-50 elif 7>days>=3: return 40*days-20 else: return days*40 def spending_money(days): return 200*days #expense def trip_cost(city,days,nights): return plane_ride_cost(city)+rental_car_cost(days)+spending_money(days)+hotel_cost(nights) print trip_cost("Tampa",3,3)
Following are the error messages
Oops, try again. trip_cost('Charlotte', 1, 0) returned 423 instead of the correct value 363
Oops, try again. trip_cost('Tampa', 7, 0) returned 1850 instead of the correct value 1430
Oops, try again. trip_cost('Los Angeles', 3, 0) returned 1175 instead of the correct value 995
Oops, try again. trip_cost('Tampa', 3, 0) returned 920 instead of the correct value 740
However at the output window I get no errors but the correct solution
Or I am getting mad! I know there is something very simple or obvious I am missing out. Thanks in advance for you response.