import sys
fib_list = []
def fib(max_num):
a, b = 0, 1
while b < max_num:
fib_list.append(b)
a, b = b, a+b
print fib_list
print "The Fibonacci sequence contained between 1 and %d has %d values !" % (max_num, len(fib_list))
if __name__ == "__main__":
if len(sys.argv) != 2:
print "please input argv"
else:
fib(int(sys.argv[1]))
网友评论