-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.6.all_operatores.py
81 lines (61 loc) · 2.32 KB
/
2.6.all_operatores.py
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Operatores:
'''
Hame follwoing type ke Operatores milte hain:
1. Arithmatic Op (Math ke sare signs)
2. Assigment Op (=)
3. Comparison Op (< > ! ==)
4. Logical Op (And Or Not)
5. Identity Op (is)
6. Membership Op (in)
7. Bitwise Op (True/False)
1. Arithmatic Op (Math ke sare signs):
+(add)
-(sub)
*(mul)
/(div)
%(modulus)
**(exponetiation)
//(floor div value)
2. Assigment Op (=):
Example:
a = 10
b = a + 10
b += 10 (b = b + 10)
3. Comparison Op (< > ! ==):
Example: a = 10 , b = 10
equal to: a == b like as print('Comapre a == b: ',a == b)
not equal: a != b
greater: a > b
greaten equal to: a >= b
lessten: a < b
less then equal to: a <= b
4. Logical Op (And Or Not):
Example: print(a < b and a <= b)
and: and ka matlab hai ki manlo ki a aur b do student hai class me aur condtion hai ki: jab a and b 2no class me present honge tabhi class chalegi other wise nahi chalegi.
Chalegi ka matlab: True
Nahi chalegi ka matlab: False
or: or ka matalab hai ki koi bhi ek condtion sahi ho gai to hame True mil jayega. Jaise ki and ki condtion me hi agar or ka use karle to hame True milega. Because example me a<b ye Flase hai but a<=b ye True hai aur ek condtion sahi hai so hamre True milega.
not: iska matlab hai ki koi bhi ek condtion hame escape karna chate hai to not ka use kiya jata hai, Jaise ki a<b ye condtion False hai aur hum isko escape karna chate hain.
not(a < b)
5. Identity Op (is, is not): is ke use se True ya False check kiya jata hai. aur iske liye compare hi kiya jata hai but yaha par 2 varibale ki vlaues ke alwa unke address ko bhi compare kiya jata hai.
Example:
a is b =>> print(a is b)
a is not b
6. Membership Op (in, not in):
Example:
listval = [3,4,5,6]
Print me check kar rahe hai ki kya 5 hamre list me exits karta hai ya nahi. Agar karta hai then True milega
print(5 in listval)
Manlo hum check kar rahe hai ki kya 2 rollnumber hamare listval ke andar hai ya nahi
print(2 not in listval)
7. Bitwise Op (True/False): ye bit form me values ka result deta hai aur ye logical op ki tarh hota hai.
& and
| or
! not
'''
'''
Programming Languge Types:
1. Low Level language:
1. assembly lanaguge
2. Hight Level Language
'''