Python Taking A Vacation 3/7 Infinite Run button glitch


#1

Heres my code:
I run the code and the run button keeps circling but doesnt complete the task, please help.
def hotel_cost(nights):
return 140*nights

def plane_ride_cost(city):
if city == “Charlotte”:
return 183
if city==“Tampa”:
return 220
if city==“Pittsburgh”:
return 222
if city==“Los Angeles”:
return 475

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


#2

I just finished this lesson. Here’s my code:

def hotel_cost(nights):
#hotel cost $140 per night
return 140 * nights

def plane_ride_cost(city):
if city == “Charlotte”:
return 183
elif city == “Tampa”:
return 220
elif city == “Pittsburgh”:
return 222
else:
city == "Los Angeles"
return 475

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

You can compare it to yours to check for differences.


#3

Ok, thank you for your code but even when running your code the run button activates and infinitely spins yielding no error/answer/output.


#4

I’m having the same problem with 2/7 :triumph: and I have to complete the whole python course for homework…
Code:
def hotel_cost(nights):
return 140 * nights


#5

Trust me man I feel ya pain, I reset the whole thing and im almost upto the vacation section. Hopefully it doesnt glitch out.


#6

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