This is part of a tutorial. My goal was to take an input from user and then increment it while a condition is true.
inputNum = raw_input("What is max number?")
def incrementF(greatest):
i = 0
numbers = []
while i < greatest:
print "At the top of the list numbers is %d" % i
numbers.append(i)
i += 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
print "The numbers:"
for num in numbers:
print num
incrementF(inputNum)
When I run the script and type anything in for inputNum, rather than a few lines of output, I appear to run into an infinite loop.
For example, is the raw input prompt gave 10, I'd have expected to see something like:
At the top of the list numbers is 0, Numbers now: 0, 0 At the top of the list numbers is 1, Numbers now: 1, 1
I've read over my script several times and cannot see. I suspect it could have something to do with indenting? But I'm not sure.