Why doesn't the cost show up in the console?


#1

this is the code I wrote, and I got a congratulations, you did it, but why is "none" still showing up in the console instead of a cost?
def hotel_cost(nights):
return 140. * nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
if city == "Tampa":
return 220
if city == "Pittsburgh":
return 222
if city == "Los Angeles":
return 475
def rental_car_cost(days):
rent = 40 * days
if days >= 7:
rent -= 50
elif days >= 3:
rent -= 20
return rent
def trip_cost(city, days, spending_money):
print trip_cost("Los Angeles", 5, 600)
print trip_cost("Tampa", 7, 500)


#2

Hi, @sherylpit ,

It is important to format code when you post it. That enables users to see your indentation and other important details.

See How do I format code in my posts?.

Part of the problem may relate to the indentation of your code, so we need to see it, with formatting. Another part of the problem is that your trip_cost function has no return statement, so it returns the value, None.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.