Skip to content

Commit e13bd2d

Browse files
lesson2122230
1 parent d872782 commit e13bd2d

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

212223lesson.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Special Operators . .
2+
# 1.Identity Operator
3+
# - is , is not (memory location)
4+
# 2.Membership Operator
5+
6+
# a = 10
7+
# b = 20
8+
# c = a is b
9+
# print('memory location using is word : ', c)
10+
11+
p = 10
12+
t = 10
13+
# if p is t:
14+
# print('They are same location')
15+
# else:
16+
# print('The are not the same location')
17+
# p = 20
18+
# if p is t:
19+
# print('second time, They are same location')
20+
# else:
21+
# print(' second time, They are not the same location')
22+
23+
# if p is not t:
24+
# print('they are not the same location')
25+
# else:
26+
# print('they are same location')
27+
28+
###### checking type by using is keyword
29+
30+
w = type(p) is int
31+
# print('type() by is ', w)
32+
33+
r = type(p) is not int
34+
# print('type() check by is not', r)
35+
36+
y = type(p) is float
37+
# print('type() check by is for float',y)
38+
39+
40+
# String check
41+
42+
u = 'Pyae Phyo Thant'
43+
o = 'Pyae Phyo Thant'
44+
# print(id(u),id(o))
45+
e = u is o
46+
# print('e',e)
47+
48+
# if u is o:
49+
# print('they are same location')
50+
# else:
51+
# print('they are not the same location')
52+
53+
# Membership
54+
# - in , not in
55+
56+
mylist = ["apple", "banana", "cherry"]
57+
checkItem = "banana" in mylist
58+
# print('check item has or not', checkItem)
59+
checkItem2 = "banana" not in mylist
60+
# print('check item not has', checkItem2)
61+
# def pver():
62+
# return 0
63+
# print('return 0', pver())
64+
65+
pptList1 = [1,2,3,4,5]
66+
pptList2 = [6,7,8,9]
67+
68+
def overLap(pptList1,pptList2):
69+
p = 0
70+
t = 0
71+
for i in pptList1:
72+
p+=1
73+
for i in pptList2:
74+
t+=1
75+
for i in range(0,p):
76+
for j in range(0,t):
77+
if pptList1[i] == pptList2[j]:
78+
return 1
79+
return 0
80+
81+
# Notes => if the return value is 0 => falsy!!!!
82+
if overLap(pptList1,pptList2):
83+
print(overLap(pptList1,pptList2))
84+
else:
85+
print('____________________')

0 commit comments

Comments
 (0)