Page 60 - Information_Practice_Fliipbook_Class11
P. 60
>>> 20 + 30 # Addition operation: +
50
>>> 5.3 * 40 # Multiplication operation: *
212.0
Table 3.3 shows some of the commonly used operators in Python. You will learn about operators in detail in the next
chapter.
Table 3.3: Operators in Python
+ - * / % // ** Arithmetic Operators
= Assignment Operator
==, !=, >, <, >=, <= Relational Operators
and, or, not Logical Operators
3.3 Variables
A variable (also called a name) is an identifier that denotes a data value.
For example, using the assignment operator (=), the data values 'India' and 225.6 may be associated with the
variables country and area, respectively, as follows:
>>> country = 'India'
>>> area = 225.6
Python syntax for assigning a value to a variable may be described as follows:
Syntax:
<Variable_name> = <value>
In this book, we use the above notation to describe Python syntax. While the text in the angular brackets is replaced
by the appropriate Python expressions, the keywords and the operators appear as they are. Thus, in the assignment
statement,
country = 'India'
Variable_name is replaced by the variable name country, the assignment operator = appears as described in
the syntax, and value is replaced by the value 'India'.
country India
area 225.6
Now, let us have a look at some examples of valid and invalid variable names.
Examples of Valid Identifiers (variable names)
Roll_no
rollNo
_num
WHILE
price
46 Touchpad Informatics Practices-XI

