RunCollatz - # ------class Reader (object) : def read...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python # ------------------------------------- # projects/python/collatz/RunCollatz.py # Copyright (C) 2010 # Glenn P. Downing # ------------------------------------- # To run the program # RunCollatz.py < RunCollatz.in > RunCollatz.out # To document the program # pydoc -w Collatz RunCollatz TestCollatz from Collatz import collatz_read, collatz_eval, collatz_print # ------ # Reader
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # ------class Reader (object) : def read (self) : return raw_input() # ------# Writer # ------class Writer (object) : def write (self, a, v) : for i in a : print i, print v # ----# main # ----def main () : &quot;&quot;&quot; runs the program &quot;&quot;&quot; a = while collatz_read(Reader(), a) : v = collatz_eval(a) collatz_print(Writer(), a, v) if __name__ == &quot;__main__&quot; : main()...
View Full Document

Ask a homework question - tutors are online