I need to return a list of numbers input by the user.
I have tried to insert an empty list and then using the .append
function to append the input value to the list.
def ask_a_number():
trials = []
playernumber = int(input('Guess a number: '))
trials = trials.append(playernumber)
return playernumber, trials
ask_a_number()
Lets say I want to input 5.
So I want the function to return 5 and also a list trials = [5]
.
Next time when I input 10, the function should return trials = [5,10]
.