[英]How do I passing an input variable from one function to another without it asking for the input multiple times?
假设我想获取变量a
的输入,然后使用将重复的 function 中的输入,但 function 将更改并将输入保存为不同的值,但保存为相同的变量,因此我不需要用户输入多个次。
a = input("")
b = input("")
c = a + b
c = a
我保存a
等于c
所以我想要的所有输入都是b
但我 go 如何重复 function 而不是重复提示输入a
当我想要的只是保留a+b
的值时。
我希望我能正确理解你的问题。
你可以这样做:
a = "hello"
a = a + "world"
a = "helloworld"
input()
对你也一样:
a = a + input()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.