01 import sys 02 03# Here's our main function. Python is pretty efficient here. You 04# should notice that there are no braces. Python is dependant on
05 # whitespace to define blocks. 06 07 def main(): 08 print "\nHow many numbers of the sequence would you like?" 09 n = int(sys.stdin.readline())
10 fibonacci(n) 11 12# Here's the fibonacci function. Like in Perl, you can assign multiple 13# variables on a line without using a temporary variable. Also, the for 14# loop here works more like a foreach loop by setting a range from 0 to n.
15 16 def fibonacci(n): 17 a,b = 0,1 18 for i in range(0,n): 19 print a
20 a,b, = b,a+b 21 22 main()