Where is a bug


    def rental_car_cost(days):
        cost = days * 40;
        if days > 7:
            return cost - 50
        elif days >= 3:
            return cost - 20
            return cost
    def hotel_cost(days):
        return days * 140
    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
    def trip_cost(city, days):
        return rental_car_cost + hotel_cost + plane_ride_cost;
    trip_cost(city = raw_input(":"), days = raw_input("Mehmonxona ijarasi"))


The entire body of this function needs to be indented four more spaces.

This may be valid, but is not what was asked for in the instructions. We could shorten somewhat, bearing in mind that this is outside of the lesson:

>>> def trip_cost(city, days):
	return city, days
>>> trip_cost(raw_input("city: "), raw_input("days: "))
city: Tampa
days: 5
('Tampa', '5')

Be sure to pass the lesson with the expected code.

print trip_cost("Tampa", 5)

as an example. Use the city and days given in the instructions.


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