Using IDLE
The Python programs in this book have been written in Python, saved as a .py
file, and then executed in an integrated development environment. However, there is another approach to executing Python that you will see mentioned in many texts. This is the Python IDLE environment (included with the Python package) that lets you execute Python code line by line.
IDLE is an interpreter that reads a line of Python as it is input and then executes it. This is very helpful if you want to test a few lines of code without going to the trouble of creating a source program.
Consider the following example, where the text in bold font is my input:
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 4
>>> y = 5
>>> print('Sum =', x+y)
Sum = 9
>>>
When you run a compiled...