Week2 program rewritten in python (not an assignment)