Page 92 - Information_Practice_Fliipbook_Class11
P. 92
Finally, clicking <Next> twice displays the object id of two lists, lst1 and lst2, in the Print output box (Fig 4.17).
Fig 4.17: Code Visualization through Python Tutor (after execution of line 7 and 8)
State whether the following are mutable or immutable.
1. marks = 78.50
2. rating = "5 stars"
3. marks = [45,70,65,53]
4. riverNames = ('Ganga','Yamuna','Chenab')
5. rankings = {'points':12, 'rank':2}
4.4 Operators
An operator is used to perform a specific operation on an object or objects, also known as operands. For example, in the
expression 10 + 20, the values 10 and 20 are operands, and + is an operator. Python's operators can be grouped
into two main groups based on how many operands they work with. A unary operator takes only one operand, while
a binary operator takes two operands. For example, the unary minus (-) and unary (+) are used to specify positive or
negative signs of a number. However, the binary arithmetic operators, such as + (addition),- (subtraction),*(product),
and / (division) need two operands. Consider the following statement:
value = -6 + 9.2
In the expression on the RHS, the first operator (unary minus) is a unary operator, and the second operator (+) is a
binary operator that will perform the addition of the operands -6 and 9.2. Therefore, the final value, 3.2 will be
assigned to the variable value.
The operators in Python can also be grouped by the type of operation they do, as enumerated below:
● Arithmetic Operators
● Relational Operators
● Assignment operators
● Logical Operators
● Identity Operators
● Membership Operators
78 Touchpad Informatics Practices-XI

