From 0e9742640a594402fc1ae43cd47cdb7f368d5d10 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Mon, 8 Jan 2024 23:30:24 +0630 Subject: [PATCH 01/18] lesson345 --- lesson3.py | 41 ++++++++++++++++++++++++++++++++++++----- lesson4.py | 37 +++++++++++++++++++++++++++++++++++++ lesson5.py | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 lesson4.py create mode 100644 lesson5.py diff --git a/lesson3.py b/lesson3.py index 677acb7..5cfdc49 100644 --- a/lesson3.py +++ b/lesson3.py @@ -4,14 +4,14 @@ z = "green" x = y = z = 20 -print("x",x) -print("y",y) -print("z",z) +# print("x",x) +# print("y",y) +# print("z",z) x = 5 y = 15 -print("x",x) -print("y",y) +# print("x",x) +# print("y",y) # identifier @@ -37,4 +37,35 @@ # Tuple # dictionary +# arithmetic operators +x = 1.1 +y = 2.2 +# print(x+y) + +a = 5 +b = 6 +# print(a*b) + +c = 3.9 +d = 3.3 +# print(c/d) +# print(c%d) + +# complex (use j/J) real part + imginary part +a = complex(1,2) +# print(a) +# print(a.real) +# print(a.imag) + +# convert using float() int() and complex() +x = 100 +y = 2.8 +z = 1j + +# convert integer to float +print(float(x)) +# convert float to integer +print(int(y)) +# convert int to complex +print(complex(x)) \ No newline at end of file diff --git a/lesson4.py b/lesson4.py new file mode 100644 index 0000000..791fbda --- /dev/null +++ b/lesson4.py @@ -0,0 +1,37 @@ +# control structures +a = 400 +b = 300 +# if a < b : +# # print('a less than b') +# else : +# # print('b greater than a') + + +c = 500 +d = 500 +# if c < d: +# # print('c less than d') +# elif c > d: +# # print('c greater than d') +# else : +# # print('c and d value are equal') + +# largest Number +a = 100 +b = 200 +c = 300 +d = 400 + +if (a > b) and (a > c) and (a > d) : + largestNumber = a + print('Largest Number is : ', largestNumber) +elif (b > a ) and ( b > c) and (b > d) : + largestNumber = b + print('largest Number is : ', b) +elif (c > a) and (c > b) and (c > d): + largestNumber = c + print('largest Number is : ', largestNumber) +else : + largestNumber = d + print('largest Number is : ', largestNumber) + diff --git a/lesson5.py b/lesson5.py new file mode 100644 index 0000000..7f19ddb --- /dev/null +++ b/lesson5.py @@ -0,0 +1,37 @@ +# calculator program +# Lesson 5 + +print("Press + for Add") +print("Press - for Subtract") +print("Press * for Multiply") +print("Press / for Divide") + +userInput = input('please enter operator for Add or Subtract or Multiply or Divide') +# print(userInput) +print('you entered : ', userInput) + +firstNumber = int(input('Enter Your First Number')) +print('your first number is : ', firstNumber) + +secondNumber = int(input('Enter Your Second Number')) +print('your second number is : ', secondNumber) + +if userInput == '+' : + result = firstNumber + secondNumber + print('result is :', result) +elif userInput == '-' : + result = firstNumber * secondNumber + print('result is :', result) +elif userInput == '*' : + result = firstNumber * secondNumber + print('result is :', result) +elif userInput == '/' : + result = firstNumber / secondNumber + print('result is :', result) +else : + print('your input {} is invalid ! Please try again later!'.format(userInput) ) + exit() + + + + From ba38768aa49b52fa46fcafbf7f1a45f89f2b2e7b Mon Sep 17 00:00:00 2001 From: pyae phyo thant <96177991+coderpyaephyothant@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:35:30 +0630 Subject: [PATCH 02/18] Create README.md --- 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..12d10c3 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +> Learning Python Programming . . . From 7884f726270a09a073ea99cbeb5f71131aa13951 Mon Sep 17 00:00:00 2001 From: pyae phyo thant <96177991+coderpyaephyothant@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:36:05 +0630 Subject: [PATCH 03/18] Create README.md --- 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..efcda87 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +> Learning Python Programming Language From 46751903eacf7fde4152a98696c6a9c6f1936257 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Tue, 9 Jan 2024 23:00:37 +0630 Subject: [PATCH 04/18] 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 05/18] 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 8c06cf13ca6f8c814c1e3e55389265070843f431 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Thu, 11 Jan 2024 20:19:07 +0630 Subject: [PATCH 06/18] lesson8Random --- 8lesson.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 8lesson.py diff --git a/8lesson.py b/8lesson.py new file mode 100644 index 0000000..f297b65 --- /dev/null +++ b/8lesson.py @@ -0,0 +1,49 @@ +# Random +import random + + +# The random() method returns a random floating number between 0 and 1. +# print(random.random()) + +# for integers randint() randrange() +# print(random.randint(2,6)) + +# random.randrange(start, stop, step) +print(random.randrange(2,8,2)) + +# random.choice(sequence) +# random.sample(sequence, k) sequence Required. A sequence. Can be any sequence: list, set, range etc. && k Required. The size of the returned list +# fruits = ['Apple', 'Banana', 'Orange', 'Grapes', 'Strawberry'] +# print(random.choice(fruits)) +# print(random.sample(fruits,2)) + +# random.seed(a, version) +# *** Random.seed is not secure!!!!!!!!!!!!!!!!!! +# a Optional. The seed value needed to generate a random number. +# If it is an integer it is used directly, if not it has to be converted into an integer. +# Default value is None, and if None, the generator uses the current system time. + +# version An integer specifying how to convert the a parameter into a integer. +# Default value is 2 + +# random.seed(42) +# print(random.random()) + +# shuffle +# Shuffle a list (reorganize the order of the list items): +# fruits = ['Apple', 'Banana', 'Orange', 'Grapes', 'Strawberry'] +# print('Before Shuffle/ original fruits list', fruits) +# random.shuffle(fruits) +# print('Shuffled List', fruits) + +# uniform random.uniform(a, b) +# a Required. A number specifying the lowest possible outcome +# b Required. A number specifying the highest possible outcome +# The uniform() method returns a random floating number between the two specified numbers (both included). + +# print('uniform', random.uniform(5,10)) +# random.triangular(low, high, mode) +# print(random.triangular(20, 60, 10)) + + + From c85805d60a8cabb12aee407b9bb5ebaa13ffbd15 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Fri, 12 Jan 2024 00:01:32 +0630 Subject: [PATCH 07/18] lesson9SecretRandoms --- 9lesson.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 9lesson.py diff --git a/9lesson.py b/9lesson.py new file mode 100644 index 0000000..a6e9912 --- /dev/null +++ b/9lesson.py @@ -0,0 +1,38 @@ +# Secure random +import secrets + +# secrets.SystemRandom + +# randint & randint +# secureGenerator = secrets.SystemRandom() +# secureRandNumber = secureGenerator.randint(2,10) +# print('secured random numbers', secureRandNumber) + +# secureGenerator = secrets.SystemRandom() +# secureRandNumberByRange = secureGenerator.randrange(2,11,4) +# ရွေးချယ်ခွင့် တိုးပွားမှုကို သတ်မှတ်သည့် ကိန်းပြည့်။ default 1 +# print('secured random numbers ranges', secureRandNumberByRange) + +# choice & sample +# fruits = ['Apple', 'Banana', 'Orange', 'Grapes', 'Strawberry'] +# secureGenerator = secrets.SystemRandom() +# secureFruit = secureGenerator.choice(fruits) +# print('securedFruit', secureFruit) + +# secureGenerator = secrets.SystemRandom() +# secureFruitSample = secureGenerator.sample(fruits,2) +# print('secureFruitSample', secureFruitSample) + +# secret.token_byte +# print(secrets.token_bytes(4)) +# print(secrets.token_bytes(2)) +# secret.token_hex 2 => 4 , 4 => 8 +# print(secrets.token_hex(3)) + +# Token URL safe +# print(secrets.token_urlsafe(2)) + +passwordResetLink = 'http://resetUrlLink/reset=' +passwordResetLink += secrets.token_urlsafe() +print('url secretlinks', passwordResetLink) + From b59b7709474f8247830c15d995a9213f8fa51f2f Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sat, 13 Jan 2024 17:18:07 +0630 Subject: [PATCH 08/18] lesson10LotteryGamePart1 --- 10lesson.py | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 10lesson.py diff --git a/10lesson.py b/10lesson.py new file mode 100644 index 0000000..ca4f88a --- /dev/null +++ b/10lesson.py @@ -0,0 +1,75 @@ +# lottery game +import secrets +secureNumber = secrets.SystemRandom() +# build object +# print(secureNumber) + +while True: + print('_________Welcome to 2D game with Python Programming_________') + # exit() + press1 = int(input('______Press 1 for RULES OR 2 to start Game!____')) + if press1 == 1: + print(' >Your Age must be greater than or equal 17! ') + print(' >You need aleast 10000 Coin! ') + print(' >Your need to use aleast 1000 Coin to start game! ') + if press1 == 2: + print(' >You can start to play game Now! -----------') + print(' > Now, You need to fill some of your informations...') + print('Lets Start!') + clientName = input('Type your name : at least 3 words') + clientAge = int(input('Type your age : at least 17year!')) + if len(clientName) < 3: + print('Your Name must be aleast 3Characters!') + if clientAge < 17: + print('Your Age must be aleast 17!') + exit() + if len(clientName) > 3 and clientAge >= 17: + print('You can play game Now. ...') + print('Welcome', clientName ,'!. . ') + clientMoney = int(input('Now, Enter your coin! : aleast 10000 Coin')) + while clientMoney < 10000 or None: + print('Coin must be aleast 10000!', clientName, 'coin is', clientMoney ) + clientMoney = int(input('Please valid coin!')) + if clientMoney < 10000: + continue + if clientMoney >= 10000: + print('Hello', clientName, 'Thanks You! - - - -') + clientUseMoney = int(input('How many conin wanna use ? Enter. :aleast 1000 : ')) + while clientUseMoney < 1000 or None: + print('Use Coin must be aleast 1000!', clientName, 'Used coin is : ', clientUseMoney ) + clientUseMoney = int(input('Please valid Use coin!')) + if clientUseMoney < 1000: + continue + if clientUseMoney >= 1000: + print('You used ', clientUseMoney , 'coin for game!- - -') + luckyNum = int(input('Insert your lucky Number! Must be two Number!------ ')) + while len(str(luckyNum)) < 2 or None: + print('Use two number!', clientName, 'inserted lucky number is', luckyNum ) + luckyNum = int(input('Please valid Luck Number!')) + while len(str(luckyNum)) < 2 or len(str(luckyNum)) > 2: + continue + if len(str(luckyNum)) == 2: + sysNumber = secureNumber.randint(10,99) + countNum = 0 + while countNum < 3: + print('Wait... What is Number Today is . . .') + countNum +=1 + if sysNumber == luckyNum: + clientMoney = clientMoney + clientUseMoney + print('Today Number is : ', sysNumber) + print('Hey',clientName,'Congratulation. . .You Won!!!!----') + print('Hey',clientName,'You got',clientMoney) + else: + clientMoney = clientMoney - clientUseMoney + print("Today number is :", sysNumber) + print("Your Lucky number is :", luckyNum) + print("Sorry..Good Luck again", clientName) + print('Hey',clientName,'Your Coin : ',clientMoney) + print('Your Coin',clientMoney) + + + + + + + \ No newline at end of file From d251adf5808b489f648f2f4e1b280907a9a6cfe9 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 28 Jan 2024 10:39:50 +0630 Subject: [PATCH 09/18] lesson10lotterygameerrFix --- 10lesson.py | 98 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/10lesson.py b/10lesson.py index ca4f88a..beac9c3 100644 --- a/10lesson.py +++ b/10lesson.py @@ -6,7 +6,6 @@ while True: print('_________Welcome to 2D game with Python Programming_________') - # exit() press1 = int(input('______Press 1 for RULES OR 2 to start Game!____')) if press1 == 1: print(' >Your Age must be greater than or equal 17! ') @@ -18,54 +17,69 @@ print('Lets Start!') clientName = input('Type your name : at least 3 words') clientAge = int(input('Type your age : at least 17year!')) + print('_____you entered___', len(clientName)) + print('_____you entered___', clientAge) if len(clientName) < 3: print('Your Name must be aleast 3Characters!') + exit() if clientAge < 17: print('Your Age must be aleast 17!') exit() - if len(clientName) > 3 and clientAge >= 17: + while len(clientName) >= 3 and clientAge >= 17: print('You can play game Now. ...') print('Welcome', clientName ,'!. . ') - clientMoney = int(input('Now, Enter your coin! : aleast 10000 Coin')) - while clientMoney < 10000 or None: - print('Coin must be aleast 10000!', clientName, 'coin is', clientMoney ) - clientMoney = int(input('Please valid coin!')) - if clientMoney < 10000: - continue - if clientMoney >= 10000: - print('Hello', clientName, 'Thanks You! - - - -') - clientUseMoney = int(input('How many conin wanna use ? Enter. :aleast 1000 : ')) - while clientUseMoney < 1000 or None: - print('Use Coin must be aleast 1000!', clientName, 'Used coin is : ', clientUseMoney ) - clientUseMoney = int(input('Please valid Use coin!')) - if clientUseMoney < 1000: - continue - if clientUseMoney >= 1000: - print('You used ', clientUseMoney , 'coin for game!- - -') - luckyNum = int(input('Insert your lucky Number! Must be two Number!------ ')) - while len(str(luckyNum)) < 2 or None: - print('Use two number!', clientName, 'inserted lucky number is', luckyNum ) - luckyNum = int(input('Please valid Luck Number!')) - while len(str(luckyNum)) < 2 or len(str(luckyNum)) > 2: - continue - if len(str(luckyNum)) == 2: - sysNumber = secureNumber.randint(10,99) - countNum = 0 - while countNum < 3: - print('Wait... What is Number Today is . . .') - countNum +=1 - if sysNumber == luckyNum: - clientMoney = clientMoney + clientUseMoney - print('Today Number is : ', sysNumber) - print('Hey',clientName,'Congratulation. . .You Won!!!!----') - print('Hey',clientName,'You got',clientMoney) - else: - clientMoney = clientMoney - clientUseMoney - print("Today number is :", sysNumber) - print("Your Lucky number is :", luckyNum) - print("Sorry..Good Luck again", clientName) - print('Hey',clientName,'Your Coin : ',clientMoney) - print('Your Coin',clientMoney) + while True: + clientMoney = int(input('Now, Enter your coin! : aleast 10000 Coin')) + while clientMoney < 10000 or None: + print('Coin must be aleast 10000!', clientName, 'coin is', clientMoney ) + clientMoney = int(input('Please valid coin!')) + if clientMoney < 10000: + continue + while clientMoney >= 10000: + if clientMoney >= 10000: + print('your money is ', clientMoney) + print('Hello', clientName, 'Thanks You! - - - -') + clientUseMoney = int(input('How many conin wanna use ? Enter. :aleast 1000 : ')) + while clientUseMoney < 1000 or None: + print('Use Coin must be aleast 1000!', clientName, 'Used coin is : ', clientUseMoney ) + clientUseMoney = int(input('Please valid Use coin!')) + if clientUseMoney < 1000: + continue + if clientUseMoney >= 1000: + print('You used ', clientUseMoney , 'coin for game!- - -') + luckyNum = int(input('Insert your lucky Number! Must be two Number!------ ')) + while len(str(luckyNum)) < 2 or None: + print('Use two number!', clientName, 'inserted lucky number is', luckyNum ) + luckyNum = int(input('Please valid Luck Number!')) + while len(str(luckyNum)) < 2 or len(str(luckyNum)) > 2: + continue + if len(str(luckyNum)) == 2: + sysNumber = secureNumber.randint(10,99) + countNum = 0 + while countNum < 3: + print('Wait... What is Number Today is . . .') + countNum +=1 + if luckyNum == sysNumber: + clientMoney = clientMoney + clientUseMoney + print('Today Number is : ', sysNumber) + print('Hey',clientName,'Congratulation. . .You Won!!!!----') + print('Hey',clientName,'You got',clientMoney) + + playAgainNum = int(input('enter 1 to play again OR Enter 0 to QUIT****')) + while clientMoney > 0: + if playAgainNum == 1: + break + while playAgainNum == 0: + exit() + else: + clientMoney = clientMoney - clientUseMoney + print("Today number is :", sysNumber) + print("Your Lucky number is :", luckyNum) + print("Sorry..Good Luck again", clientName) + print('Hey',clientName,'Your Coin : ',clientMoney) + if clientMoney == 0 or clientMoney < 1000: + exit() + From dd6ac0e9ba126e808616a4d8036b37044d28f129 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 28 Jan 2024 22:32:27 +0630 Subject: [PATCH 10/18] lesson11121314 --- 1112lesson.py | 10 +++++++ 13lesson.py | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ 14lesson.py | 13 +++++++++ 3 files changed, 103 insertions(+) create mode 100644 1112lesson.py create mode 100644 13lesson.py create mode 100644 14lesson.py diff --git a/1112lesson.py b/1112lesson.py new file mode 100644 index 0000000..22e239c --- /dev/null +++ b/1112lesson.py @@ -0,0 +1,10 @@ +yourInput = input('enter your number') +while True: + if yourInput.isdigit() and len(yourInput) <3: + print('your input must be atleast 3word') + break + elif yourInput.isdigit() and len(yourInput) > 3: + print('not greater than 3') + else: + print('ok') + break \ No newline at end of file diff --git a/13lesson.py b/13lesson.py new file mode 100644 index 0000000..8bc3074 --- /dev/null +++ b/13lesson.py @@ -0,0 +1,80 @@ +# for loop with example + +# 1.while loop +# x = 0 +# while x < 5: +# print(x) +# x += 1 + +# for loop with break +# i = 1 +# while i < 6: +# print(i) +# if i == 3: +# break +# i += 1 + + +# p = 10 +# while p < 25: +# print(p) +# if p == 18: +# break +# p += 1 + +# for loop with continue +# 意味 => 止める現状の反復 / 次へ続く + +# i = 0 +# while i < 6: +# if i == 3: +# i += 1 +# continue +# print(i) +# i += 1 + + +# 2 range +# x = range(6) +# for n in x: +# print(n) + +# range with for loop +# p = 0 +# for p in range(5): +# print(p) + +# Tuple +# tup=('h','e','l','l','o') +# for p in tup: +# print(p) +# Loop Tuple with list +# packing +# lootu = [(1,2),(3,4)] +# for p in lootu: +# print(p) +# unpacking +# for p,t in lootu: +# print(p,t) + +# print(0%7) +# for p in range(5): +# t = p%3 +# print(t) +# if t == 0: +# print('modulus') +# else: +# print('modulus not zero') + +# Zero Division Error ___ Try Except Finally +# for p in range(5): +# print('loop in range 5, p : ', p) +# try: +# 10/(p-3) +# except ZeroDivisionError: +# print('divided by zero') +# finally: +# print('not divided by zero') + + + diff --git a/14lesson.py b/14lesson.py new file mode 100644 index 0000000..722486b --- /dev/null +++ b/14lesson.py @@ -0,0 +1,13 @@ +# string with for loop +words = 'pyaephyothant' +# for x in words: +# print(x, end='-') +# with index +# i = 0 +# for x in words: +# print(i,x) +# i+=1 +# enumerate +# for i,x in enumerate(words): +# print(i,x) + From 0f7a0b00abcd19842a0aed3a1ce3a748ae6d49e1 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Mon, 29 Jan 2024 22:15:21 +0630 Subject: [PATCH 11/18] 14lesson --- 14lesson.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/14lesson.py b/14lesson.py index 722486b..b4fcc43 100644 --- a/14lesson.py +++ b/14lesson.py @@ -1,5 +1,5 @@ # string with for loop -words = 'pyaephyothant' +# words = 'pyaephyothant' # for x in words: # print(x, end='-') # with index @@ -11,3 +11,33 @@ # for i,x in enumerate(words): # print(i,x) +# row = int(input('write number between 1 and 5')) +# for p in range(row): +# for t in range(p): +# print('*',t,'t') +# print('-',p,'p') + + +# row = int(input('write number between 1 and 10')) +# for p in range(row): +# for t in range(p): +# print(t,end='') +# print('-') + +# for p in range(1,row): +# # print(p,'p') +# for t in range(p): +# print(t,end='') +# print('-') + +# x = range(3, 0, -2) +# print(x) +# for n in x: +# print(n) + +putInNumber = int(input('insert value of a number between 1 and 5 = ')) +for p in range(5,putInNumber): + for t in range(p,0,-1): + print('t',t) + print('-') + From 430f39d64614cd2147c18f225b8399562f8bb34b Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sat, 3 Feb 2024 18:20:31 +0630 Subject: [PATCH 12/18] 15lesssonWithPyramicAndReversePyramic --- 15lesson.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 15lesson.py diff --git a/15lesson.py b/15lesson.py new file mode 100644 index 0000000..5d7ef1a --- /dev/null +++ b/15lesson.py @@ -0,0 +1,21 @@ +# pyramic triangle +# forRow = int(input('Enter number to make pyramic')) +# spaceRow = forRow +# for i in range(1,forRow): +# for j in range(spaceRow): +# print(end=' ') +# spaceRow = spaceRow-1 +# for k in range(1,i*2): +# print('*',end='') +# print('') + +# reverse pyramic triangle +forRow = int(input('Enter number to make reverse pyramic')) +forStar = forRow +for i in range(1,forRow): + for j in range(i): + print(' ',end='') + for k in range((forStar*2),3,-1): + print('*',end='') + forStar = forStar-1 + print(' ') \ No newline at end of file From e768b3e2ed3e1c1ce5733b942f03e177e0e00539 Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sat, 3 Feb 2024 18:58:45 +0630 Subject: [PATCH 13/18] 16LessonMemoryAllocation --- 16lesson.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 16lesson.py diff --git a/16lesson.py b/16lesson.py new file mode 100644 index 0000000..5e6d010 --- /dev/null +++ b/16lesson.py @@ -0,0 +1,22 @@ +# Memory address +p = 10 +e = 10 + +t = id(p) +y = hex(p) + +w = id(e) +v = hex(e) + +# print(p) +# print(t) #decimal value +# print(y) #hex value +# print(v) +# print(w) + +if t == w : + print('Same Memory',t,w) +else: + print('Different memory allocation',t,w) + + From e7bb3a8ab7cbf28ad00e047866b50ab34e57057a Mon Sep 17 00:00:00 2001 From: coderpyaephyothant Date: Sun, 4 Feb 2024 10:49:09 +0630 Subject: [PATCH 14/18] 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 15/18] 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 16/18] 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 17/18] 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 18/18] 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)) +