任何帮助表示赞赏,还有任何大的缺陷或您在格式化或基本的方式中看到的东西,请指出。谢谢!
day = raw_input("How many days?")
locations = raw_input("Where to?")
days = str(day)
location = str(locations)
spendingMoney = 100
def hotel(days):
return 140 * days
def destination(location):
if location == "los angeles":
return 300
if location == "boston":
return 400
def rental(days):
if days < 2:
return 40 * days
if days >= 2 and days <= 6:
return days * 30
if days >= 7:
return days * 25
def total_cost(days, location):
return hotel(days) + destination(location) + rental(days)
print total_cost(days, location)