Hardware Reference
In-Depth Information
FIGURE 5-1 he Raspberry Pi desktop, with Python's IDLE and IDLE 3
programming environments both available
Programming in Python: Using a
Function
To begin working with Python, double-click the IDLE 3 icon on the desktop, or open
the main menu, navigate to Programming and select IDLE 3. You will be using Python
3 throughout this topic rather than earlier versions, which use a diferent syntax. he
Python shell, or command-line interface, opens and a prompt of three angle symbols
( >>> ) appears to indicate where you should type your code, as shown in Figure 5-2.
For your irst Python program, you'll write only one line of code, using a function, a
piece of code that tells the computer to perform a speciic task. For this program, you
use the print() function to tell the computer to print some text on the screen. Place
the string of text you want the computer to display inside the brackets, with quota-
tion marks around it.
Search WWH ::




Custom Search