# Transportation

#1

Hello,

Please help me out for getting reed of this error message,And tell me where i was going wrong:

def hotel_cost(nights):
return 140*nights
hotel_cost(2)
def plane_ride_cost(city):
if city=="Charlotte":
return hotel_cost+(183*2)
elif city=="Tampa":
return hotel_cost+(220*2)
elif city == "Pittsburgh":
return hotel_cost+(222*2)
elif city == "Los Angeles":
return hotel_cost+(475*2)
else:
return "Your City is not in our list"

"""city = raw_input("Enter the name of city")
night = raw_input("Enter the number of days")

hotel_cost(night)
plane_ride_cost(city)"""

days= raw_input("Enter the number of days")
def rental_car_cost(days):
rent=40

``````s =type(days)
if s==int:
if days>=7:
rent_amount=days*50
return rent_amount

elif days=>3 and days<=7:
rent_amount=days*20
return rent_amount

else:
rent_amount=rent+40

else:
return "Enter the valid number of days"``````

#2

I am not sure which part of the "transportation" section you need help with. is it the "Getting There" part or "Transportation" part?

if it is the second part, this is the way i solved it.

def rental_car_cost(days):
cost = 40 * days

`````` if days >= 7:
return cost - 50

elif days >= 3:
return cost - 20

elif days < 3:
return cost``````

hopefully this helps.

good luck.

#3

try to include the exactly error message t make it easier to detect the problem

#4

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 "none"
def rental_car_cost(days):
if days >= 7:
return (days * 40) - 50
elif days >= 3 and days <= 6:
return (days * 40) - 20
else:
return days * 40

This works fine fellas!!

#5

thanks for the code..it's really help me..

#7

This worked for me!!

`````` def rental_car_cost(days):
if days >= 7:
return (days * 40) - 50
elif days >= 3 and days <=6:
return (days * 40) - 20
else:
return days * 40``````