fork download
  1. def fib(i=100):
  2. start = 0
  3. stop = 1
  4. count = 2
  5. print (start),
  6. while (count<i):
  7. print (start),
  8. start,stop=stop,start+stop
  9. count+=1
  10. return start
  11. print"*******The Fibonacci Sequence**************"
  12. answer=raw_input("Would you like to use the default sequence of 100 (Y/N)?\n")
  13. if (answer=="Y" or answer=="y"):
  14. print fib()
  15. else:
  16. i=input("Enter the number of oterations: ")
  17. i = int(i)
  18. print fib(i)
  19.  
Success #stdin #stdout 0s 23352KB
stdin
n
20
stdout
*******The Fibonacci Sequence**************
Would you like to use the default sequence of 100 (Y/N)?
Enter the number of oterations:  0 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584