Weird output running a fibonacci sequence
Question: Brand new to using python, need help figuring out why my command line is
spitting out huge strings of numbers and not the fib sequence up to the var I
pass in. Here is what I have so far:

    
    
    import sys
    
    def fib(n):
        a, b = 0, 1
        while a < n:
            print a
            a, b = b, a+b
    
    if __name__ == "__main__":
        fib(sys.argv[1])
    

Now before I did sys.argv[1] or [1:] I was able to put in a sequence in n up
to the number I wanted. I.e if I entered n as 12 I would get 0,1,1,3,5,8 which
is correct. However I cannot get this to work. I did a print statement after
the def fib(n): as print n. It would return my sys.argv pass in.

Where am I going wrong? Thanks for your time.


Answer: Don't forget to convert the input argument (a string) into an integer type:

    
    
    fib(int(sys.argv[1]))
    

