1) Type your python script in a notepad.
2) Save the notepad as "Save as">>All file. Name teh file with the .py extension
3)Now close and open the file using the IDLE IDE
4) Select the "Options" option from the file and "Run Module" to execute the file.
The execution will open in a new IDLE window with the output.
More Examples:
However, We could also execute this program bu just Double Clicking on the file .
However, once you enter the user name and press " Enter". The program crashes.
In order to retain the execution window even after the code execution, You could add in another line of code to request the user to press Enter...
input("Press<Enter>")