Page 71 - ModularV1.1 _c8_flipbook
P. 71
Print statement is used to display a string on the screen. The string should always be enclosed
in (“ ”) double quotes or (‘ ’) single quotes.
Calculations can also be done directly on the IDLE prompt.
To perform calculations, perform the following steps:
Step 1 Write 372 + 7 at the prompt.
>>> 372 +7
Step 2 Press the Enter key.
The result 379 is displayed on the screen.
You can also use print statement to do the above calculation. Perform the following steps:
Step 1 Write the following command using the print statement
>>> print (372 + 7)
Step 2 Press the Enter key.
You see the same output 379 on the screen.
Performing Calculations
Clickipedia
The IDLE Editor has syntax-highlighting feature. This is used to display Python keywords,
commands, literals, text, etc. in different colours and fonts.
VARIABLES IN PYTHON
Variables are memory locations that are used to store values. When a variable is created, some
space is allocated in memory for it. This memory space is referred by the name that we give to
the variable. It is easy to create a variable in Python. You just need to assign a value to a variable.
For example,
age = 30
name = “Nisha”
temp = 35.7
price = 625.50
Here 30, “Nisha”, 35.7 and 625.50 are the values assigned to variables named age, name, temp
and price respectively.
Introduction to Python 69

