This was a continuation to my older question The program was working fine without the
while True: main() if input(\"Try Again? (Yes/No)\").strip().upper() == \'
You defined print_factors inside of main(), meaning it's not a function available to the global scope
Give main() a body, and unindent print_factors() and it should resolve your issues