-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperator.py
More file actions
37 lines (31 loc) · 1017 Bytes
/
Copy pathoperator.py
File metadata and controls
37 lines (31 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#operators
# 1. assigment operator
x=10
x+=100 #x=x+10 short form even for *,-etc
print(x) #peinting x=x+10
# 2.comparison operator
a=10
b=100
print(a==b) ##prints boolean value either true or false
print(a>b) #prints boolean value either true or false
print(a<b) ##prints boolean value either true or false
print(a!=b) #prints boolean value either true or false
# 3.logical operator
print(2>3 and 2<3) #if one is false then o/p is false
print(2>3 or 2<3) #if one true then o/p is true
print(not(2<3))
# 4.membership operator
list="python"
print("p" in list) #prints boolean value either true or false
print("b" not in list) #prints boolean value either true or false
#using logical in membership operator
s1="darshan"
s2="deekshitha"
print(("d" in s1)and("z" in s2)) #prints boolean value either true or false
print(("d" in s1)or("z" in s2)) #prints boolean value either true or false
print(not("d" in s1))
# 5.bitwise operator
a=2 #binary value:010
b=5 #binary value:101
print(a&b) #o/p:0
print(a|b) #o/p:7