this is my code on python 3.2.3 IDLE:
numbers = []
numbers = input("(Enter a empty string to quit) Enter a number: ")
while numbers != "":
numbers = input("(Enter a empty string to quit) Enter a number; ")
numbers.append(n)
print ("The list is", numbers)
problem now is, i can’t append the list.
if i make numbers = int(input( then it works for appending the list but won’t let me quit out of entering the numbers.
if i make numbers = input
like i have right now, it won’t let me append the list
how can i get these numbers to append to a list?
There are two problems:
numbersinstead ofn;append()is in the wrong place.Try the following:
If you want to store integers instead of string, change the
append()line to:Stylistically, if the first prompt is the same as the prompt for all subsequent inputs, I’d restructure the code as follows: