我在学Python3。前进,但输入命令困惑我,因为他们不启动自己?除了谷歌和youtube,我没有接受过这方面的正规教育。我知道我缺少一些基本的东西。你知道吗
我在www上看过了。请详细解释一下好吗?你知道吗
def take_input():
print (" ")
city = input("which city do you wish to travel to? \n Options are: delhi, kolkata, bombay, bengaluru : ")
city.lower()
print (" ")
days = int(input("How many days are you travelling for? eg 1 - 100 : "))
nights = days - 1
print (" ")
spending_money = int(input("How much spending money do you plan on carrying?, eg 100 - 10000 : "))
return city, days, spending_money , trip_cost(city, days, spending_money)
# trying to collect user data
#remaining code removed for minimal reproducible question :)
while True:
take_input()
while True
是Python的基础。 意思是“永远这样”。 对于永远运行且永不停止的项目来说,这一点很重要。 你可以用break
来打破它。你知道吗我来谈谈你的密码。您正在使用
return
,但是您没有对返回的变量执行任何操作。例如,您可以使用print()
打印它们示例:
相关问题 更多 >
编程相关推荐