Author: Maciej Fijalkowski <fij...@gmail.com> Branch: extradoc Changeset: r3816:74a9317c6e25 Date: 2011-07-01 11:49 +0200 http://bitbucket.org/pypy/extradoc/changeset/74a9317c6e25/
Log: merge diff --git a/talk/ctpug2011/src/count.py b/talk/ctpug2011/src/count.py new file mode 100644 --- /dev/null +++ b/talk/ctpug2011/src/count.py @@ -0,0 +1,23 @@ +import sys +import time + +def count_mult_of_5(N): + mult = 0 + not_mult = 0 + for i in range(N): + if i % 5 == 0: + mult += 1 + else: + not_mult += 1 + return mult, not_mult + +def main(): + N = int(sys.argv[1]) + start = time.clock() + count = count_mult_of_5(N) + end = time.clock() + print 'count: ', count + print 'time:', end-start, 'secs' + +if __name__ == '__main__': + main() _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit