From e7bb3a8ab7cbf28ad00e047866b50ab34e57057a Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 4 Feb 2024 10:49:09 +0630 Subject: [PATCH 1/3] 1718lesson --- 1718lesson.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 1718lesson.py diff --git a/1718lesson.py b/1718lesson.py new file mode 100644 index 0000000..5c3d1c3 --- /dev/null +++ b/1718lesson.py @@ -0,0 +1,61 @@ +# Logical Operators +# p = True +# print('not p value is : ', not p) + +# Lesson18 +# Bitwise Operators +# Bitwise operators are used to compare (binary) numbers: + +# Bitwise AND +a = 60 +b = 13 +c = 0 +c = a & b +# print('bitwise and operation', c) + +# 60 /2 & 13/2 , 2|60 - 0 2|13 -1 +# 2|30 - 0 2|6 - 0 +# 2|15 - 1 2|3 -1 +# 2|7 - 1 2|1 +# 2|3 - 1 +# 2|1 + # 1 1 1 1 0 0 # 1 1 0 1 + # 0 0 1 1 0 1 + # Ans Bitwise & 0 0 0 0 1 1 0 0 = 12 + + +# Bitwise OR +e = 60 +f = 13 +g = 0 +g = e | f +# print('bitwise or operation', g) + +# 111100 +# 001101 +# Ans Bitwise | 00111101 = 61 + + +# Bitwise Nor +a = ~ 10 +# print('Bitwise Nor', a) +# format => - (num + 1 ) + +# decimal to binary 2|10 - 0 + # 2|5 - 1 + # 2|2 -0 + # 2|1 + # 1010 (need to add 1) + # -(1011) + +# Two's complement +# 10 => 1010 +# inverse => 0101 +# plus one => 0110 +# and then change plus to minus , minus to plus + + + + + + From d872782d48f428bdc023053b616198d743b88eab Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 4 Feb 2024 11:49:51 +0630 Subject: [PATCH 2/3] 1920lesson --- 1920lesson.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 1920lesson.py diff --git a/1920lesson.py b/1920lesson.py new file mode 100644 index 0000000..17e7b9b --- /dev/null +++ b/1920lesson.py @@ -0,0 +1,34 @@ +# Xor RightShift Leftshifi +a = 5 +b = 2 +c = a^b +# print('Xor value is ', c) +# 5 => 101 +# 2 => 10 +# 101 +# 10 +# 00000111 + +# Right shift >> more younger +x = 10 +y = x>>2 +# print('right shift ', y) + +# x => 00001010 +# remove (right2place) and add two zero infront of +# x => 00000010 (Answer) + +# Left shift << more older +p = 15 +t = p << 3 + +# print('Left shift value is ', t) + +# p => 00001111 +# remove lefplace 01111 + 000 +# p => 01111000 + + + + + From e13bd2d116d1131f31bad0f80445c4a5d346132a Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 4 Feb 2024 21:40:30 +0630 Subject: [PATCH 3/3] lesson2122230 --- 212223lesson.py | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 212223lesson.py diff --git a/212223lesson.py b/212223lesson.py new file mode 100644 index 0000000..0b4711b --- /dev/null +++ b/212223lesson.py @@ -0,0 +1,85 @@ +# Special Operators . . +# 1.Identity Operator +# - is , is not (memory location) +# 2.Membership Operator + +# a = 10 +# b = 20 +# c = a is b +# print('memory location using is word : ', c) + +p = 10 +t = 10 +# if p is t: +# print('They are same location') +# else: +# print('The are not the same location') +# p = 20 +# if p is t: +# print('second time, They are same location') +# else: +# print(' second time, They are not the same location') + +# if p is not t: +# print('they are not the same location') +# else: +# print('they are same location') + +###### checking type by using is keyword + +w = type(p) is int +# print('type() by is ', w) + +r = type(p) is not int +# print('type() check by is not', r) + +y = type(p) is float +# print('type() check by is for float',y) + + +# String check + +u = 'Pyae Phyo Thant' +o = 'Pyae Phyo Thant' +# print(id(u),id(o)) +e = u is o +# print('e',e) + +# if u is o: + # print('they are same location') +# else: + # print('they are not the same location') + +# Membership +# - in , not in + +mylist = ["apple", "banana", "cherry"] +checkItem = "banana" in mylist +# print('check item has or not', checkItem) +checkItem2 = "banana" not in mylist +# print('check item not has', checkItem2) +# def pver(): +# return 0 +# print('return 0', pver()) + +pptList1 = [1,2,3,4,5] +pptList2 = [6,7,8,9] + +def overLap(pptList1,pptList2): + p = 0 + t = 0 + for i in pptList1: + p+=1 + for i in pptList2: + t+=1 + for i in range(0,p): + for j in range(0,t): + if pptList1[i] == pptList2[j]: + return 1 + return 0 + +# Notes => if the return value is 0 => falsy!!!! +if overLap(pptList1,pptList2): + print(overLap(pptList1,pptList2)) +else: + print('____________________') \ No newline at end of file