3 ms·
Considering they are learning python, and the prompt says to generate the value of Pi, this is a great chance to introduce generators[1], the yield statement, a
by merlincorey 13y ago
Considering they are learning python, and the prompt says to generate the value of Pi, this is a great chance to introduce generators[1], the yield statement, and the itertools[2] module to someone.
Of course, in my version, I'd generate the value of Tau.
[1] http://stackoverflow.com/questions/102535/what-can-you-use-python-generator-functions-for http://stackoverflow.com/questions/102535/what-can-you-use-p...
[2] http://docs.python.org/library/itertools.html http://docs.python.org/library/itertools.html