2024-04-20 04:06:07 发布
网友
我在用Python编写一个简单的程序。首先,用户输入一些数据。如果数据等于“y”,则循环开始
ans = raw_input() if ans.lower() == 'y': for path in mas[]: print("This is cycle") function() print("End of program")
问题是终端只输出“程序结束”。循环中的函数和文本输出都不起作用。你知道吗
很简单,你可以这样做:
while True: cont = raw_input("Another one? yes/no > ") if cont == "no": print("End of program") break if cont == "yes": print("This is cycle")
如果使用Python3,请将raw_input更改为input。你知道吗
raw_input
input
很简单,你可以这样做:
如果使用Python3,请将
raw_input
更改为input
。你知道吗相关问题 更多 >
编程相关推荐