Lesson Progress
0% Complete

Using the Python Shell, IDLE, and Writing the FIRST program

The IDLE program that is bundled with the Python interpreter is used for coding. Start by launching the IDLE program by typing “IDLE” in the search box on Windows. After it is found, select IDLE (Python GUI) for launching it. The Python Shell opens up, permitting the use of Python in interactive mode. Thus, one command can be entered after another, and each one is executed by the Shell immediately, returning the result before the next command is entered.    

Type this into the Shell:  

(Note that the lines stated following >>> are the user’s commands, while the next statement is the result)  

>>> 8+9
17
>>> 7>1
True
>>> print ('Great Day’) 
Great Day 

Upon typing 8+9, the Shell is directed to assess the result of 8+9. Thus, the answer returned is 17. Upon typing 7>1, the Shell evaluates whether 7 is greater than 1 and returns true. The next is a print command, instructing the Shell to display Great Day.

The Python Shell is especially convenient to test Python commands, particularly when beginning the journey of programming. Exiting the Python Shell will eliminate all the commands that were typed. Additionally, the Python Shell cannot be used for creating a program, for which the code must be typed in a text file, which must be saved with a .py extension. Such files are referred to as Python scripts.