Let's say we have a function like this
def function():
while True:
user_input = input("enter a number: ")
if user_input == "0":
print("finish")
break
print("the number is " + user_input)
And in the main() we call the function
function()
Then it will ask for user input until it gets a "0". What I want to do is like have something can store all the input, and automatically give it to the console. So, I don't need to manually type them in the console.
Please note that I'd like to have the function not accepting arguments and use something_taken_as_input
without passing it as an argument.
something_taken_as_input = ["1","2","3","0"]
function()
# enter a number: 1
# enter a number: 2
# enter a number: 3
# enter a number: 0
# finish
# all done by the program, no manually typing!