Creating Python programs for command-line use involves a certain amount of repetitious coding, which can often be left off or forgotten. Here is a form which includes everthing.
Note that if you are using Windows, you can add Python programs to your “File New” menu and automatically include the above text in the new file. This article shows you how. Other operating systems have their own automation features.