Python Convention

To indicate that the Python file is a script intended to be run and not as a library, the author will put the following code in the file:

def main():
  ...

if __name__ == "__main__":
  main()

The main function is defined instead of using bare statements is to avoid declaring and defining variable(s) globally that could have resulted in unexpected change of program state.

#python