I placed a while-loop inside of a function 'count()'.
Ideally, I want the user to pick a number between one and 10. If said number "n" < the base number (i), then print and add 1.
The problem is that when n > i, the process continues as if being ignored.
i = 0
numbers = []
print "Pick a number between 1 and 10:"
n = raw_input("> ")
def count(x,y):
while x < y:
print "First number is %d" % x
numbers.append(x)
x += 1
print "Total numbers now: ", numbers
print "Last number = %d" % x
count(i,n)
I believe this has something to do with the While-Loop being placed inside of a function, or perhaps I'm not seeing it.
My returned product looks something like this:
At the top, i is 9
Numbers now: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
At the bottom i is 10
I am still learning Python (my first language) and trying to follow a tutorial. I am aware that it may be better to do For-Loops instead, however this is the current topic I'm still trying to grasp.