From 7ba22c4d61570244b13da8e9031ec7de64e6bd5e Mon Sep 17 00:00:00 2001 From: semih <77213397+semihPy@users.noreply.github.com> Date: Wed, 3 Feb 2021 09:26:15 +0100 Subject: [PATCH 1/5] Assignment-1 Week-4 @secedit --- a1_w4.py | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 a1_w4.py diff --git a/a1_w4.py b/a1_w4.py new file mode 100644 index 0000000..baca61c --- /dev/null +++ b/a1_w4.py @@ -0,0 +1,71 @@ +'''' +############################################################################################# +#*******************************************************************************************# +# Copyright (c) 2020 pyCoder|semih Corporation;) All rights reserved. ## +# [Timestamp:20210201] ## +#*******************************************************************************************# +############################################################################################# +''' + +# 1 - Random Password +# As a user, I want to use a program which can generate random password and display the result on user interface. +# So that I can generate my password for any application. + +# Acceptance Criteria: +# Password length must be 10 characters long. +# It must contain at least 2 upper case letter, 2 digits and 2 special symbols. +# You must import some required modules or packages. +# The GUI of program must contain at least a button and a label. +# The result should be display on the password label when the user click the generate button. + +import random +import tkinter + +''' +ASCII karakter kodlarini referans alan, random karakter kodu listeleri olusturdum. +sonra bu kodlari chr() metodu ile yazdirdim. +''' +table1 = tkinter.Tk() # passwordLabel table icin assign ettim. + +def random_password(): + special_symbol_list = [random.randint(33, 47) for i in range(2)] # 2 itemli random special_symbol_list olusturdum + digits_list = [random.randint(48, 57) for i in range(2)] # 2 itemli random digits_list olusturdum + upper_case_list = [random.randint(65, 90) for i in range(2)] # 2 itemli random upper_case_list olusturdum + rest_list = [random.randint(97, 122) for i in range(4)] # 4 itemli random rest_list olusturdum + total_list = [] # tum listeleri birlestirmek icin total_list. + + rest_list.extend(special_symbol_list) # iki listeyi birlestirdim. + digits_list.extend(upper_case_list) # iki listeyi birlestirdim. + + total_list.extend(rest_list) # uc listeyi birlestirdim. + total_list.extend(digits_list) # dort listeyi birlestirdim. + + password = '' # password u tutmak icin bos string assign ettim. + for i in range(10): + password += chr(total_list[i]) # listedeki karakter kodlarini chr() ile karakter olarak birlestirdim. + + passwordLabel = tkinter.Label(table1, text=password, fg="white", bg="black", font="Verdana 19") + passwordLabel.pack(fill=tkinter.X) +def main(): + table = tkinter.Tk() # bir tkinter objesi olusturup table a atadim. + table.title("Random Password Maker") # pencerenin basligini belirledim. + table.geometry('999x400') # boyutlarini belirledim. + table.columnconfigure(0, weight=1) + + # table_Label + label = tkinter.Label(table, text="Random Password Maker is Ready!", font=("Open Sans", "10", "bold")) + label.pack() + + # acceptance_Criteria_Label + criteriaLabel = tkinter.Label(table, + text="Password will contain at least 2 upper case letter, 2 digits and 2 special symbols.") + criteriaLabel.pack() + + # password_Button + button = tkinter.Button(table, text="A Password Create", fg="orange", font=("Open Sans", "10", "bold"), + command=random_password) + button.pack(padx=110, pady=70) + table.mainloop() # dongu olusturdum. + +if __name__ == '__main__': # bu dosya calisinca once main metodundan basla dedim. + main() From bdc18faaa114238ee8b8b297bf8960edfabe6d72 Mon Sep 17 00:00:00 2001 From: semih <77213397+semihPy@users.noreply.github.com> Date: Wed, 3 Feb 2021 09:29:04 +0100 Subject: [PATCH 2/5] Assignment-2 Week-4 --- a2_w4.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 a2_w4.py diff --git a/a2_w4.py b/a2_w4.py new file mode 100644 index 0000000..97ccdd2 --- /dev/null +++ b/a2_w4.py @@ -0,0 +1,48 @@ +'''' +############################################################################################# +#*******************************************************************************************# +# Copyright (c) 2020 pyCoder|semih Corporation;) All rights reserved. ## +# [Timestamp:20210202] ## +#*******************************************************************************************# +############################################################################################# +''' + +# 2 - The Least Common Multiple. +# As a user, I want to use a program which can calculate the least common multiple (L.C.M.) of four numbers. +# So that I can find the least common multiple (L.C.M.) of my inputs. + +# Acceptance Criteria: + +# Ask user to enter the four numbers. +# Use try/except blocks to verify input entries and warn the user for Nan or non numerical inputs. +# Calculate the least common multiple (L.C.M.) of four numbers +# Use gcd function in module of math. + +import math + +numbers_list = [] # kullanicidan alinan 4 sayiyi listede tutmak icin. +gcd_compute = [] # obeb lerini tutmak icin. +while True: # hatali giris yapildigi surece donmesi icin. + try: # hatali girisleri yakalamak icin. + numbers = input("Enter 4 numbers with spaces between them: ").strip(" ").split() # str tutan numbers list olusur. + for i in range(4): + numbers_list.append(int(numbers[i])) # girilen sayilari int tutan numbers_list e ekledim. + break # hatali giris yoksa while dongusunu kirdim. + except: + print("Please only enter numbers!") # hatali girislerde bu mesaj goruntulenir. + +gcd_compute.append(math.gcd(numbers_list[0], numbers_list[1])) # gcd() kullararak ilk iki sayinin obeb ini hesapladim. +gcd_compute.append(math.gcd(numbers_list[2], numbers_list[3])) # gcd() kullararak son iki sayinin obeb ini hesapladim. + +LCM_list = [] # sayilarin okek ini tutmak icin +j = 0 # gcd_compute listesi item lerine ulasmak icin.(obeb) +for i in range(2): + i += i + multiple = numbers_list[i] * numbers_list[i + 1] # numbers_list teki ilk iki ve sonra son iki sayi carpimi. + LCM_list.append(int(multiple / gcd_compute[j])) # ilk iki sayinin carpimlarini obeb ine boldum. sonucu listede tuttum. + j += 1 +gcd_compute2 = math.gcd(LCM_list[0], LCM_list[1]) # yeni olusan iki sayinin da gcd() ile obeb lerini hesapladim. +LCM_result = LCM_list[0] * LCM_list[1] # yeni olusan iki sayiyi carptim. +result = LCM_result / gcd_compute2 # sonucta istenen okek i result a atatim. +print("The Least Common Multiple of {},{},{},and {} are --> {} <--" + .format(numbers_list[0], numbers_list[1], numbers_list[2], numbers_list[3], int(result))) From 23a79e4f6ebd14a99d594fc2b18f1cbafc42915b Mon Sep 17 00:00:00 2001 From: semih <77213397+semihPy@users.noreply.github.com> Date: Wed, 3 Feb 2021 09:33:55 +0100 Subject: [PATCH 3/5] Assignment-3 Week-4 --- a3_w4.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 a3_w4.py diff --git a/a3_w4.py b/a3_w4.py new file mode 100644 index 0000000..ca76286 --- /dev/null +++ b/a3_w4.py @@ -0,0 +1,47 @@ +'''' +############################################################################################# +#*******************************************************************************************# +# Copyright (c) 2020 pyCoder|semih Corporation;) All rights reserved. ## +# [Timestamp:20210202] ## +#*******************************************************************************************# +############################################################################################# +''' +# 3- Number Guessing Game +# As a player, I want to play a game which I can guess a number the computer chooses in the range I chose. +# So that I can try to find the correct number which was selected by computer. + +# Acceptance Criteria: +# Computer must randomly pick an integer from user selected a range, i.e., from A to B, where A and B belong to Integer. +# Your program should prompt the user for guesses +# if the user guesses incorrectly, it should print whether the guess is too high or too low. +# If the user guesses correctly, the program should print total time and total number of guesses. +# You must import some required modules or packages +# You can assume that the user will enter valid input. + +import random +from time import time + +print('%' * 56) +print("%%%%%%%%[+ The Number Guessing Game Begins! +]%%%%%%%%") +print('%' * 56) +min_n = int(input("enter a min integer number for Number Guessing Game:")) # min sayiyi aldim. +max_n = int(input("enter a max integer number for Number Guessing Game:")) # max sayiyi aldim. +chosen_number = random.randint(min_n, max_n) # girilen araliktan bir sayi secti computer. +print("the computer chose a number..") +n = 1 # tahmin sayisini tutmak icin +t1 = time() # sureyi baslattim. +while True: # hatali tahmin girilirse dongu devam eder. + guess = int(input("your guess: ")) # oyuncudan tahmini ni aldim. + if guess == chosen_number: # random belirlenen ile oyuncunun tahmin sayisi esitse. + print("[[Congratulations! Your {}. guess!".format(n)) # game over, sonucu yazdirdim + break # oyuncu bildi ise while dan cikar. + elif guess > chosen_number: # tahmin daha buyukse, yonlendirdim. + print("try a smaller number:") + n += 1 + elif guess < chosen_number: # tahmin daha kucukse, yonlendirdim. + print("try a bigger number:") + n += 1 + continue # tahmin dogru degilse while in basina doner. +t2 = time() # oyuncu bildi ise while dan cikar. sureyi durdurdum. +elapsed = t2 - t1 # fark alip gecen sureyi hesapladim. +print('Elapsed time is %f seconds.]]' % elapsed) From 5d6ce1180fe2315ae3be18fb4e21eb6fbf31c846 Mon Sep 17 00:00:00 2001 From: semih <77213397+semihPy@users.noreply.github.com> Date: Wed, 3 Feb 2021 09:37:03 +0100 Subject: [PATCH 4/5] HackerR_findDigits --- HackerR_Find_Digits.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 HackerR_Find_Digits.py diff --git a/HackerR_Find_Digits.py b/HackerR_Find_Digits.py new file mode 100644 index 0000000..60fcbfc --- /dev/null +++ b/HackerR_Find_Digits.py @@ -0,0 +1,28 @@ +'''' +############################################################################################# +#*******************************************************************************************# +# Copyright (c) 2020 pyCoder|semih Corporation;) All rights reserved. ## +# [Timestamp:20210201] ## +#*******************************************************************************************# +############################################################################################# +''' + +n_loop = int(input("number of loop:")) +counter = 1 +for i in range(n_loop): # kac sayi girisi istendi ise onu sinirladim. + counter = 1 # bolunebilen digit leri tutmek icin. (son kalan digit zaten kendine bolunur) + number = int(input("enter a number")) + rest = number # manipuasyon yapmak icin sayinin kopyasini olusturdum. orjinal sayiyi korudum. + while rest >= 10: # kalan kisim tek haneli degilse, dongu devam eder. + digit = rest % 10 # sayinin son(sag) basamagina ulastim. + + if digit == 0: # sayinin son basamagi sifir ise bu bloga girer. + rest = rest // 10 # sayinin son basamagindaki sifiri yok ettim. basamak sayisi azaldi. + else: + + if number % digit == 0: # sayimiz digit e bolunebiliyor ise bu bloga girer. + counter += 1 # count 1 artar. + rest = rest // 10 # kalan sayinin son basamagini yok ettim. + else: + rest = rest // 10 # (sayimiz digit e tam bolunemiyorsa), kalan sayinin son basamagini yok ettim. + print(counter) From 5af13183b0593a4ac715aaf52ddd433e090f6a4c Mon Sep 17 00:00:00 2001 From: semih <77213397+semihPy@users.noreply.github.com> Date: Wed, 3 Feb 2021 09:42:09 +0100 Subject: [PATCH 5/5] Assignment-4 Week-4 --- mis_calculator.zip | Bin 0 -> 3593 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mis_calculator.zip diff --git a/mis_calculator.zip b/mis_calculator.zip new file mode 100644 index 0000000000000000000000000000000000000000..23f250c5df08083c06ef7a646ce90c514a487606 GIT binary patch literal 3593 zc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