Print statement returns "None None"


#1



Taking a Vacation, Planning your trip.

After running the print statement I get the output of
None
None
Any help is appreciated.


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
    

def rental_car_cost(days):
	day_rate = 40
	total_cost = day_rate * days
	if days >= 7:
		total_cost -= 50
	elif days >= 3:
		total_cost -= 20
		
	return total_cost

	
def trip_cost(city, days, spending_money):
    rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
    
print trip_cost("Los Angeles", 5, 600)


#2

Check this line of code.
Read instructions one more time.!

Also title of your question?

Print statement returns None?

Function can do two things,

1.It can be used to show some data(print)
2.It can return things

or It can do 1 and 2.
If a function does not return anything, by default it returns None,
None is a constant that represents absence of a value.


#3

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