我正在用python编写计算器。我必须从用户那里收到很多输入来计算复杂的计算。现在,我只有2个输入。如何对来自用户的很多/无限数量的输入进行编码?
答案 0 :(得分:1)
只需将您的代码包装在while循环中
while True:
user_input = input()
if user_input == "":
break
答案 1 :(得分:0)
如何尝试将输入写入while循环呢?
old_input = ''
while(True):
number = input("Insert")
operation = old_input + number
print(operation)
old_input = number
然后您可以解析操作字符串以进行操作