# Planning Your Trip Exercise ########################## # By Ed Covert 2013 ########################## def hotel_cost(nights): #cost per night is $140 h_Cost = nights * 140 return h_Cost def plane_ride_cost(city): #cost of airfare for select cities l_City = city.lower() if l_City == "charlotte": return 183 elif l_City == "tampa": return 220 elif l_City == "pittsburgh": return 222 else: return 475 def rental_car_cost(days): #calculates rental car costs based on days of rent# Planning Your Trip Exercise ########################## # By Ed Covert 2013 ########################## def hotel_cost(nights): #cost per night is $140 h_Cost = nights * 140 return h_Cost def plane_ride_cost(city): #cost of airfare for select cities l_City = city.lower() if l_City == "charlotte": return 183 elif l_City == "tampa": return 220 elif l_City == "pittsburgh": return 222 else: return 475 def rental_car_cost(days): #calculates rental car costs based on days of rental if days == 3 or 4 or 5 or 6: return (days * 40) -20 elif days == 7: return (days * 40) - 50 else: return days * 40 al if days == 3 or 4 or 5 or 6: return (days * 40) -20 elif days == 7: return (days * 40) - 50 else: return days * 40
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question