Now that we have installed our interpreter, we will open the IDLE program that comes with it.
Open the search bar on your taskbar and search for the IDLE program.
Once found, open the application and it will open the Shell.
The Shell opens as a window (as shown below).
The Shell is a convenient tool to test commands, especially when first starting out to learn the language. However, when the Shell is restarted, all commands previously typed in it will be erased. Additionally, it cannot be used to code actual programs. We will need a text file with the .py file format to write and run an actual program.
Make a new file with Ctrl + N. In the file, enter a basic command such as print ('Hello World').
Note: print() is a function. We will discuss functions in detail later on.
Save the file by pressing Ctrl + S and save it as a .py file in a location you please.
Press F5 (shortcut key for Run > Run module) in the file and it will run the code you have typed in (Side note: opening the .py file on its own will flash a window for a split-second and close).
No comments:
Post a Comment