Can't understand the error! :O


#1

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"

I've typed the following code.. And it says "Oops, try again. It looks like plane_ride_cost does not return 183 when the city is Charlotte." And I don't know where I went wrong. Can someone help?


#2

Hello, @arcblaster84674!
The problem is that instead of returning a numeric value, you're returning a literal value.
Just remove the double quotes " " from your return statements and it should work.

 print 2 # number
 print "2" # literal

#3

Yes, that would have made more sense..
But, It's very surprising that I changed the 'c' in charlotte to 'C' and it worked.. :open_mouth: I haven't made any other changes.. really! :open_mouth:


#4

True, there was also that!
But returning a string was quite right though since in later lessons you'd use that to calculate the total cost of the trip but I'm glad you found out what was wrong and fixed! :slightly_smiling: