Page 427 - ComputerScience_Class_11
P. 427
Output
Integer Literal: 10
Float Literal: 3.14
Complex Literal: (5+2j)
String Literal (Double Quotes): Python
String Literal (Single Quotes): Hello
Boolean Literal a: True
Boolean Literal b: False
Special Literal (None): None
Multi-line String: Rahul Sharma
Orange Education
New Delhi
12.9.4 Operators
In Python, operators are special symbols that perform specific operations on variables and values. They instruct the
computer to carry out actions such as mathematical calculations, comparisons or logical evaluations.
In the expression a + b, the symbol + is called the operator, because it performs the operation of addition. The values
a and b are called operands, because they are the values on which the operator works.
The different types of operators in Python are listed below:
+, - ,* ,/ ,% ,** Arithmetic Operators
= Assignment Operator
==, !=, >, <, >=, <= Relational Operators
and, or, not Logical Operators
Program 4: To demonstrate different types of operators in Python.
Program 4.py
File Edit Format Run Options Window Help
a = 10
b = 3
# Arithmetic Operators
print("Addition (+):", a + b)
print("Subtraction (-):", a - b)
print("Multiplication (*):", a * b)
print("Division (/):", a / b)
print("Modulus (%):", a % b)
print("Exponent (**):", a ** b)
# Assignment Operator
c = a + b
Installation & IDE and Fundamentals of Python Programming 425

