Skip to content

Instantly share code, notes, and snippets.

@rswofxd
Created March 23, 2012 13:19
Show Gist options
  • Save rswofxd/2170551 to your computer and use it in GitHub Desktop.
Save rswofxd/2170551 to your computer and use it in GitHub Desktop.
Fun函数定义
# -*- coding:utf-8 -*-
def fib2(n):
"""Return a list containing the Fibonacci series up to n.""" #docstring(must be """)
result = []
a,b = 0,1
while b<n :
result.append(b)
a,b = b,a+b
return result
fib2(100)
#>>>fib2(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment