I have to be missing something obvious here right? I ran test on all the variables and everything looked like it was correct when i > val the loop kept running. Any suggestions? Thanks

x = raw_input(":")

def whileloop(val):
    i = 0
    numbers = []

    while i < val:
        print "At the top i is %d" % i
        numbers.append(i)

        i = i + 1
        print "Numbers now: ", numbers
        print "At the bottom i is %d" % i

        print "The numbers: "

        for num in numbers:
            print num

whileloop(x)

val is a string and it is always greater than integer value i, because the name 'int' is before in alphabet compared to 'str'. So loop never terminates.

how would I go about making it an int? I thought python was not type specific? Bare with me, very new to python. Thank you

thank you casted to int as below and script ran

x = raw_input(":")

def whileloop(val):
    i = 0
    numbers = []

    while i < int(val):
        print "At the top i is %d" % i
        numbers.append(i)

        i = i + 1
        print "Numbers now: ", numbers
        print "At the bottom i is %d" % i

        print "The numbers: "

        for num in numbers:
            print num

whileloop(x)
This question has already been answered. Start a new discussion instead.