#!/usr/bin/env pythondef hoppity(puzzle): """ Takes a filename argument for each number in the text file and returns Hoppity, Hophop or Hop depending on the ability if the number is divided by 3,5 or both of them """ handler = open(puzzle) read_all = handler.read().splitlines() try: for num in range(1,int(read_all[0])): if num == "": read_all.remove(num) else: num = int(num) if num % 3 == 0 and num % 5 == 0: print "Hop\n" elif num % 3 == 0: print "Hoppity\n" elif num % 5 == 0: print "Hophop\n" finally: handler.close()if __name__ == "__main__": import sys hoppity(sys.argv[1])