Skip to content

Instantly share code, notes, and snippets.

@ivikash
Created November 1, 2011 06:02
Show Gist options
  • Save ivikash/1330030 to your computer and use it in GitHub Desktop.
Save ivikash/1330030 to your computer and use it in GitHub Desktop.
Testing cProfile
import cProfile
def fib(n):
"""Fibonacci series
"""
if n==0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
def fib_seq(n):
"""
"""
seq = []
if n>0:
seq.extend(fib_seq(n-1))
seq.append(fib(n))
return seq
print "RAW"
print '=' * 80
cProfile.run('print fib_seq(20); print')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment