0% found this document useful (0 votes)
22 views2 pages

Practical No 2.python

The document contains a practical assignment on Python operators, including arithmetic, logical, and bitwise operations. It provides code examples for each type of operator along with their respective outputs. The results demonstrate the functionality of these operators with sample values.

Uploaded by

pravindsawate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Practical No 2.python

The document contains a practical assignment on Python operators, including arithmetic, logical, and bitwise operations. It provides code examples for each type of operator along with their respective outputs. The results demonstrate the functionality of these operators with sample values.

Uploaded by

pravindsawate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Name:-Sangharsh parvind sawate

Class:-Co4k(B)
Roll no:-64
Subject:-python(314004)

Practical no:-03
*Arithmetic operator in python
Code:-
a = 10
b=5
sum_result = a + b
diff_result = a - b
mul_result = a * b
div_result = a / b
mod_result = a % b
exp_result = a ** b
Output:-
Sum: 15
Difference: 5
product: 50
Division: 2.0
Modulus: 0
Exponentiation: 100000

*Logical operator
Code:-
x = True
y = False
logical_and = x and y
logical_or = x or y
logical_not = not x
Output:-
Logical AND: False
Logical OR: True
Logical NOT: False

*Bitwise operator
Code:-
num1 = 5
num2 = 3
bitwise_and = num1 & num2
bitwise_or = num1 | num2
bitwise_xor = num1 ^ num2
bitwise_not = ~num1
bitwise_left_shift = num1 << 1
bitwise_right_shift = num1 >> 1
Output:-
Bitwise AND: 1
Bitwise OR: 7
Bitwise XOR: 6
Bitwise NOT: -6
Bitwise Left Shift: 10
Bitwise Right Shift: 2

You might also like