From 46751903eacf7fde4152a98696c6a9c6f1936257 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Tue, 9 Jan 2024 23:00:37 +0630 Subject: [PATCH 1/6] lesson6 --- lesson6.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lesson6.py diff --git a/lesson6.py b/lesson6.py new file mode 100644 index 0000000..6c622c1 --- /dev/null +++ b/lesson6.py @@ -0,0 +1,34 @@ +# function +numbers = [1,2,3,4,5] +# print(len(numbers)) + +# import math +import math +# num = int(input('Enter number to make square root')) +# print('Answer of {} is : {} '.format(num,math.sqrt(num))) + +# programmer defined functions +# def ppt_function(): + # print('this is def function') + +# ppt_function() + +# add substract multiply and division +def add(a,p): + return print('added value is : ',a+p) + +def substract(a,p): + return print('subtracted value is : ',a-p) + +def multiply(a,p): + return print('multiply value is : ', a*p) + +def division(a,p): + return print('divided value is : ', a/p) + +add(5,4) +substract(5,4) +multiply(5,4) +division(5,4) +print('Calculated') + From daa89df6b333a97948df974a236666757e8b511a Mon Sep 17 00:00:00 2001 From: pyae phyo thant <96177991+coderpyaephyothant@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:59:39 +0630 Subject: [PATCH 2/6] Create README.md lesson 6 --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..79cd5fb --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +> Python Programming Lesson 6 From d872782d48f428bdc023053b616198d743b88eab Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 4 Feb 2024 11:49:51 +0630 Subject: [PATCH 3/6] 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 4/6] 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 From bfdb7a5c62e76dc93a740e4f9f256de9c2fe1942 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 4 Feb 2024 22:57:08 +0630 Subject: [PATCH 5/6] 24lesson --- 24listinitital.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 24listinitital.py diff --git a/24listinitital.py b/24listinitital.py new file mode 100644 index 0000000..b07e5e4 --- /dev/null +++ b/24listinitital.py @@ -0,0 +1,10 @@ +# List Initial +pptList = [20,30,40,50] +# print(pptList[3]) +# print(pptList[-1],'reverse') + +# slicing +# print(pptList[:]) +# print(pptList[0:2]) +# print(pptList[0:-1]) +# print(pptList[0:]) \ No newline at end of file From 769048fd35e6b47487c69efb4af1c2db87e6ba95 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Tue, 6 Feb 2024 00:19:39 +0630 Subject: [PATCH 6/6] 252627 --- 25lesson.py | 19 ++++++++++++++++ 26MaxMin27.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 25lesson.py create mode 100644 26MaxMin27.py diff --git a/25lesson.py b/25lesson.py new file mode 100644 index 0000000..719a5a5 --- /dev/null +++ b/25lesson.py @@ -0,0 +1,19 @@ +pptNames = ['pyae','phyo','thant'] +# add new data +pptNames.append('Chinese') +# print('pptNames Updated',pptNames) + +# rempve() +# toRemoveName = pptNames[3] +# toRemoveName = pptNames[-1] +# print('toRemoveName',toRemoveName) +# pptNames.remove(toRemoveName) +# print('removed a name',pptNames) + +# pop() +# pptNames.pop(3) +# print(pptNames) + +# del keyword +# del pptNames[3] +# print('used del keyword',pptNames) \ No newline at end of file diff --git a/26MaxMin27.py b/26MaxMin27.py new file mode 100644 index 0000000..503b5c4 --- /dev/null +++ b/26MaxMin27.py @@ -0,0 +1,61 @@ +# MaxMin +numberList = [10,20,30,40,56,88,99,78,21] +# print(max(numberList)) +# print(min(numberList)) + +# reverse +# numberList.reverse() +# print(numberList) + +# index +# print(numberList.index(99)) + +# sum +# print(sum(numberList)) + +# sort +# numberList.sort() +# numberList.sort(reverse=True) +# print(numberList) +# sorting words + +# nameList = ['asusVivoBookLaptop','vaselineLotion','royaldDrink','alpinePurifiedDrinkingWater'] +# nameList.sort() +# nameList.sort(reverse=True) +# nameList.sort(key=len) +# nameList.sort(key=len,reverse=True) +# print(nameList) + +# slicing and remove +# intejer_list = [1,2,3,6,5,4,9,7,8] + +# for i in intejer_list[:3]: +# print('to remove element',i) +# intejer_list.remove(i) + +# print(intejer_list) + +# list play +# pptList = [] +# for i in range(1,10): +# double_value = i**2 +# print('double_value of {} is : '.format(i),double_value) +# pptList.append(double_value) +# print(pptList) +# # max value +# print(max(pptList)) +# # smallest value +# print(min(pptList)) +# # reverse value +# pptList.reverse() +# print('Reversed value of pptList is: ',pptList) + +# # index value +# for i in pptList: +# index_value = pptList.index(i) +# print('index value of {}'.format(i),index_value) + +# Tuple to list +tuple_list = (20,50,80) +print(list(tuple_list)) +