A function that returns a list of the numbers of the Fibonacci series,returnsfibonacci,def fib2(n):
A function that returns a list of the numbers of the Fibonacci series,returnsfibonacci,def fib2(n):
def fib2(n): # return Fibonacci series up to n '''Return a list containing the Fibonacci series up to n.''' result = [] a, b = 0, 1 while b < n: result.append(b) # see below a, b = b, a+b return resultf100 = fib2(100) # call itprint f100 # write the result
- Return three value,returnthreevalue,def func(x,
- Turn parameters into a dictionary,,def f(**args
- For loop through the dictionary keys,dictionarykeys,ta
- Using List Operators,usingoperators,li = ['a', '
- The repr() of a string adds string quotes and backslashe
- sys stdin readline,stdinreadline,print 'Got t
热门文章:
相关内容
- Return three value,returnthreevalue,def func(x,
- Turn parameters into a dictionary,,def f(**args
- For loop through the dictionary keys,dictionarykeys,table = {'Py
- Using List Operators,usingoperators,li = ['a', '
- The repr() of a string adds string quotes and backslashes,reprbacks
- sys stdin readline,stdinreadline,print 'Got t
- Reading the newly created file.,newlycreated,print '\nRea
- File readline(),filereadline,f = open(r's
- Strings (and numbers and tuples) are immutable,tuplesimmutable,#Str
- Basic regular expression demostration facility,,'''PYTHON SO
评论关闭