-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12_Operator.py
More file actions
48 lines (42 loc) · 1.01 KB
/
Copy path12_Operator.py
File metadata and controls
48 lines (42 loc) · 1.01 KB
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
38
39
40
41
42
43
44
45
46
47
48
#Python arethmatic operator
#Addition
print( 10 + 9 )
print( 10 - 7 ) #Substraction
print( 10 * 10 ) # Multiplication
print( 10 / 3 ) #Division
print( 10 % 2 ) # Modulas
print( 10 ** 2 ) #Exponentian
print( 10 // 2) #Floor division
#Assignment operator
a = 10
b = a + 5
print(b)
c = a - 5
print(c)
d = a / 3
print(d)
e = a % 2
print(e)
f = a * 2
print(f)
g = a ** 2
print(g)
h = a // 2
print(h)
#Python commparison operator
a == b # equal operator
a != b #Not equal operator
c > g # Greater than operator
d > i # less than
d >= v # greater than or equal
c <= f # less than or equal
#Logical operator
x > 10 and x < 10 # And operator return true if both true
x > 5 or x > 7 # or operator return true if one statement true
not( x > 10 and 4 > 100) # not reverse the result
#Identity operator
x is y # returns true if both same
x is not y #returns true if both are not same
#Python membership operator
x in y # return true if specified value is present in sequence
x not in y # retrun true if specified value is not present in sqeunce