Click on first_pgm.py to get source.
"""
File: first_pgm.py
the Python version of first_pgm.c 
use of main() in Python:
   can run as a script

              python3 first_pgm.py

   or a module

              python3  
              >>> import first_pgm
              >>> first_pgm.main()
              >>> first_pgm.DEBUG = False
              >>> first_pgm.main()
"""

import sys # for exit(), input
DEBUG = True

def main():
    n_str = input("Enter number: ")
    if DEBUG: print(f"read: {n_str}")
    for i in range(1, int(n_str)+1):
        print(f"{i:3d}. I have been bad.")
    return 0

if __name__ == '__main__':
    DEBUG = False
    errc = main() ; sys.exit(errc)  # handle proper return codes