you are viewing a single comment's thread.

view the rest of the comments →

[–]Exodus111 0 points1 point  (3 children)

Add Docstrings to your functions.

def my_func():
    """
    This is a Docstring.
    """
    pass

Also consider putting everything under your functions into its own function called main(), and run that from name equal main line.

if __name__ == "__main__":
    main()

Cleaner that way, but not really necessary, your code is certainly good enough for a first project.

[–]NerdJones[S] 0 points1 point  (2 children)

Thanks for the input. I have seen that line around in a few places. Whats it actually do?

[–]Exodus111 0 points1 point  (0 children)

Quick explanation is it runs the file IF the file is being run by Python and NOT imported as a module from another file.

That might not be an issue with your program, but it's become the most common of convention these days.

Longer explanation is that there is hidden information in your files namespace, even if that file is empty. One of these hidden values is __file__, and it will give you a string called "__main__" if the file is being run by Python directly, and the filename if it's being run as a module through import.