Plan your trip


Replace this line with your code.

Why do you place the semi colon instead of the colon at the end of the print statement?
I noticed that at the end of every DEF there is a colon
and after every IF, ELIF, and ELSE statement there is a colon as well.

Why does one have to add a semicolon after the print statement?

Thanks for the help in advance.


You do not have to do it after the if statement. But if you do after the if it is for indentation Also next time replace the line that says replace this line with your code with your code instead of a screenshot. And put the link in.


I just finished this and did not have to use the semi colon.


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):
cost = 40 * days
if days >= 7 :
return cost - 50
elif days >= 3 :
return cost - 20
else :
return cost

def trip_cost(city,days,spending_money):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money

print trip_cost (“Los Angeles”, 5 ,600)


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