-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperational.py
More file actions
52 lines (37 loc) · 1.34 KB
/
Copy pathoperational.py
File metadata and controls
52 lines (37 loc) · 1.34 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
49
50
51
# arithmetic operators
# example's :- + , - , * , / etc..
# assign value 7 in 'a'
a = 7
# assign value 8 in 'b'
b = 8
# sum of 'a' & 'b'
c = a + b
print(c)
# assignment operator
# example's :- = , += , -= , *= , /= etc..
a = 5-3 # assign 5-3 = 2 in a
print(a)
b = 6
b += 2 # increment the value of b by 2 & then assign in b
print(b)
# comparison operator
# example's :- == , > , < , <= , >= , != etc..
d = 5 != 6 # != invert the result's or output's
print(d)
# logic & operator's
# example's and , or , not etc..
e = True or False # using or operator's , if both option's are true it will retun true even one optin's is true then also return true ..
print(e)
f = True and True # using and operator's , isme kya h ki dono option me true h to true retun hoga nhi to false return hoga , agr koi bhi ek option's false hua to false return hoga !..
print(f)
# in not operator has only one operand's
print(not(False)) # using not operatior , isme result's ko invert kiya jata h or isme single operand's hote h..
# Multiplication of 'str' and 'int' ..
val1 = "7" # val1 --> Is a str ..
val2 = 2 # val2 --> Is a int ..
multi = val1*val2 # Return 77
print(multi) # Return 77
print(type(val1)) # Type of val1 is --> str ..
print(type(val2)) # Type of val2 is --> int ..
# ye code ke khatam hone ke baad
print("Code will end ..")