basic features and take a look around the environment:
- If you have not already done so, power up your Raspberry Pi and log in to the
system. - If you do not have the LXDE GUI started automatically at boot, start it now by typing
startx and pressing Enter. - Open IDLE for Python v3 by double-clicking the IDLE 3 icon or clicking the LXDE
Programs Menu icon; hovering over the Programming menu option; and clicking the
IDLE 3 menu option. You are now in the main IDLE interactive mode window.
By the Way: IDLE 3 Not IDLE
You may notice an IDLE icon and an IDLE menu option alongside the IDLE 3
options. These selections offer the IDLE shell for Python v2. Be sure to select
IDLE 3 to stay on course with this hour.
- In the IDLE 3 window, at the >>> prompt, type print and then pause and look at
the screen. You should notice that the print command has been colored violet. This is
because the print statement is considered a built-in function in Python. (You will
be learning more about the various built-in functions in the coming hours.) The color
is provided to help you recognize the syntax of your Python statement and assist in the
logic of your scripts. Look back to Table 3.1 for a reminder of the various IDLE
color codes. - Press the space bar and type ("This is my first Python" and then pause
again and look at the screen. You should notice that the text This is my first
Python is colored green because Python considers it a string literal. (You will be
learning more about string literals, too, in the coming hours. For now, just notice the
color.) - Instead of correctly finishing your Python statement, just press the Enter key. (You
are deliberately trying to generate a syntax error to see how IDLE handles syntactical
problems.) You should get the message Syntax Error: EOL error while
scanning string literal. This is because you did not correctly close the
print function. (Well, actually, you were just following directions.) - In the IDLE 3 window, type print ( and then pause. You should see a screen tip
appear in your window, similar to the one shown in Figure 3.6. IDLE attempts to
help you by giving guidance via screen tips.