Page 56 - Python Basics: A Practical Introduction to Python 3
P. 56
3.4. Inspect Values in the Interactive Window
Note
PEP stands for Python Enhancement Proposal. A PEP is a de-
sign document used by the Python community to propose new
features to the language.
Following the standards outlined in PEP 8 ensures that your Python
code is readable by most Python programmers. This makes sharing
code and collaborating with other people easier for everyone involved.
Review Exercises
You can nd the solutions to these exercises and many other bonus
resources online at realpython.com/python-basics/resources
1. Using the interactive window, display some text using print().
2. Using the interactive window, assign a string literal to a variable.
Then print the contents of the variable using the print() function.
3. Repeat the first two exercises using the editor window.
3.4 Inspect Values in the Interactive
Window
Type the following into IDLE’s interactive window:
>>> greeting = "Hello, World"
>>> greeting
'Hello, World'
When you press Enter after typing greeting a second time, Python
prints the string literal assigned to greeting even though you didn’t
use the print() function. This is called variable inspection.
55