Page 107 - TP_Pluse_V2.2_Class_6
P. 107
The general syntax of the print() function is as follows:
print [<expression 1> , <expression 2>...]
Example:
print ("Python is easy").
Let's create a program to use the input( ) and print( ) functions.
Using input() and print() functions
VARIABLES IN PYTHON
Variables are memory reference points where we store values which can be accessed or changed
later. The names given to the variables are known as identifiers. In Python, we do not need to specify
the type of variable because Python is a dynamically typed language and it identifies the variable type
automatically. Let’s understand this with the help of the given examples.
num = 0.4
_price = 30.3
TOTAL = round(_price * num,2)
print(TOTAL)
Declaring and Initialising a Variable
In Python, variables are declared and initialised at the same time in the following way:
a = 10
b = 20
print ("a=", a)
print ("b=", b)
On the output screen, a = 20 and b = 40 will be printed. You can also assign the same value to
multiple variables at the time in the following way:
a = b = 20
print ("a=", a)
print ("b=", b)
Introduction to Programming 105

