Why does my program print none after it gives the output desired for both options 4 and 5?
Did you put the call to my printTopN function in a print statement? You shouldn't. printTopN does not have a return statement and so returns None. If you have the call in a print statement, then it prints the returned value which is None.