0% found this document useful (0 votes)
6 views3 pages

PRA3.1.2.3

The document provides a Python program demonstrating the use of various operators including arithmetic, relational, logical, assignment, bitwise, membership, and identity. It includes examples of each operator with corresponding print statements to display the results. The program covers operations such as addition, subtraction, comparisons, and assignments with detailed outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

PRA3.1.2.3

The document provides a Python program demonstrating the use of various operators including arithmetic, relational, logical, assignment, bitwise, membership, and identity. It includes examples of each operator with corresponding print statements to display the results. The program covers operations such as addition, subtraction, comparisons, and assignments with detailed outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//Implement the python program using following operators-

Arithmetic,Relational,Logical,Assignment,Bitwise,Membership,Identity

//Arithmetic Operator
a = 7
b = 2

# addition
print ('Sum: ', a + b)

# subtraction
print ('Subtraction: ', a - b)

# multiplication
print ('Multiplication: ', a * b)

# division
print ('Division: ', a / b)

# floor division
print ('Floor Division: ', a // b)

# modulo
print ('Modulo: ', a % b)

# a to the power b
print ('Power: ', a ** b)

//Relational Operator

a = 5

b = 2

# equal to operator
print('a == b =', a == b)

# not equal to operator


print('a != b =', a != b)

# greater than operator


print('a > b =', a > b)

# less than operator


print('a < b =', a < b)

# greater than or equal to operator


print('a >= b =', a >= b)

# less than or equal to operator


print('a <= b =', a <= b)

//Logical Operators
a = 5
b = 6

print((a > 2) and (b >= 6)) # True

//Assignment Operator

# Assigning values using


# Assignment Operator
a = 3
b = 5

c = a + b

# Output
print(c)

a = 3
b = 5

# a = a + b
a += b

# Output
print(a)

a = 3
b = 5

# a = a - b
a -= b

# Output
print(a)

a = 3
b = 5

# a = a * b
a *= b

# Output
print(a)

a = 3
b = 5

# a = a / b
a /= b

# Output
print(a)

a = 3
b = 5
# a = a % b
a %= b

# Output
print(a)

a = 3
b = 5

# a = a // b
a //= b

# Output
print(a)

a = 3
b = 5

# a = a ** b
a **= b

# Output
print(a)

You might also like