Fibonacci sequences using generators,,'''Fibonacci
Fibonacci sequences using generators,,'''Fibonacci
'''Fibonacci sequences using generatorsThis program is part of 'Dive Into Python', a free Python book forexperienced programmers. Visit http://diveintopython.org/ for thelatest version.'''__author__ = 'Mark Pilgrim (mark@diveintopython.org)'__version__ = '$Revision: 1.2 $'__date__ = '$Date: 2004/05/05 21:57:19 $'__copyright__ = 'Copyright (c) 2004 Mark Pilgrim'__license__ = 'Python'def fibonacci(max): a, b = 0, 1 while a < max: yield a a, b = b, a+bfor n in fibonacci(1000): print n,
- Pass immutable and mutable value into function,immutab
- Nest lists (create lists containing other lists),lists
- Random integer chosen from range(6),randomchosen,impor
- Default Argument Values: If you don't want the d
- Keyword Parameters and Defaults,parametersdefaults,def
- Label font,labelfont,from Tkinter
热门文章:
相关内容
- Pass immutable and mutable value into function,immutablemutable,def
- Nest lists (create lists containing other lists),listscontaining,q
- Random integer chosen from range(6),randomchosen,import rando
- Default Argument Values: If you don't want the default to be
- Keyword Parameters and Defaults,parametersdefaults,def hello_1(
- Label font,labelfont,from Tkinter
- Convert string: to and from string,convertstring,print int('4
- Searching a list for an integer.,searchinginteger,# Create a l
- ZeroDivisionError Demo,zerodivisionerror,try: 1/0exce
- String splits by another string,stringsplits,line = 'i'mS
评论关闭