From de8b47e24cab6de65dbf137021cd062297f50647 Mon Sep 17 00:00:00 2001 From: iana-golovchenko Date: Sun, 9 Jan 2022 22:28:22 +0300 Subject: [PATCH 1/4] homework: lectures 2, practice 3 --- Practice/i.golovchenko/L2.Practice3.py | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Practice/i.golovchenko/L2.Practice3.py diff --git a/Practice/i.golovchenko/L2.Practice3.py b/Practice/i.golovchenko/L2.Practice3.py new file mode 100644 index 0000000..ecf6986 --- /dev/null +++ b/Practice/i.golovchenko/L2.Practice3.py @@ -0,0 +1,34 @@ +class Tanks: + origin_name = 'Тигр' + color = 'grey' + + def __init__(self, origin_name, color, rotating): + self.origin_name = origin_name + self.color = color + self.rotating = rotating + + def print_about(self): + print(f"{self.origin_name}, {self.color}, тип башни: {self.rotating}") + + +class Route: + route = 'mountains' + + def __init__(self, route): + self.route = route + + def print_route(self): + print(f"{self.route}") + +tank1 = Tanks('T-34', 'grey', 'swivel') +tank1.print_about() +tank1 = Route('desert') +tank1.print_route() + +tank2 = Tanks('САУ', '', 'non-reversible ') +tank2.print_about() + +tank3 = Tanks('BT-5', 'green', '-') +tank3.print_about() +tank3 = Route('forest') +tank3.print_route() From 0ae907d4b5fbfeafcc8cd1b7e30f6842cf486df6 Mon Sep 17 00:00:00 2001 From: iana-golovchenko Date: Mon, 10 Jan 2022 23:20:44 +0300 Subject: [PATCH 2/4] homework: lectures 3, practice 1,2 --- Practice/i.golovchenko/L3.Practice1.py | 10 ++++++++++ Practice/i.golovchenko/L3.Practice2.py | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 Practice/i.golovchenko/L3.Practice1.py create mode 100644 Practice/i.golovchenko/L3.Practice2.py diff --git a/Practice/i.golovchenko/L3.Practice1.py b/Practice/i.golovchenko/L3.Practice1.py new file mode 100644 index 0000000..bb4d1c7 --- /dev/null +++ b/Practice/i.golovchenko/L3.Practice1.py @@ -0,0 +1,10 @@ +while 1: + x = input("Введите число: ") + if x.isdigit(): + print(x) + elif x.lower() in "stop": + print(x) + break + else: + print(f"Введен не числовой символ: {x}") + continue \ No newline at end of file diff --git a/Practice/i.golovchenko/L3.Practice2.py b/Practice/i.golovchenko/L3.Practice2.py new file mode 100644 index 0000000..fd8c83b --- /dev/null +++ b/Practice/i.golovchenko/L3.Practice2.py @@ -0,0 +1,8 @@ +def palindrome(a): + if a == a[::-1]: + return a[::-1] + else: + print(f"Введеное слово: {a} - не палидром") + +word = str(input("Введите слово: ")) +print(palindrome(word)) \ No newline at end of file From 627a691d9d83262ea5b6d99cd0d75d11a9ceeb66 Mon Sep 17 00:00:00 2001 From: iana-golovchenko Date: Wed, 12 Jan 2022 16:57:42 +0300 Subject: [PATCH 3/4] fix --- Practice/i.golovchenko/L2.Practice3.py | 1 + Practice/i.golovchenko/L3.Practice1.py | 9 ++++++--- Practice/i.golovchenko/L3.Practice2.py | 12 +++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Practice/i.golovchenko/L2.Practice3.py b/Practice/i.golovchenko/L2.Practice3.py index ecf6986..9bc29cd 100644 --- a/Practice/i.golovchenko/L2.Practice3.py +++ b/Practice/i.golovchenko/L2.Practice3.py @@ -20,6 +20,7 @@ def __init__(self, route): def print_route(self): print(f"{self.route}") + tank1 = Tanks('T-34', 'grey', 'swivel') tank1.print_about() tank1 = Route('desert') diff --git a/Practice/i.golovchenko/L3.Practice1.py b/Practice/i.golovchenko/L3.Practice1.py index bb4d1c7..b13c693 100644 --- a/Practice/i.golovchenko/L3.Practice1.py +++ b/Practice/i.golovchenko/L3.Practice1.py @@ -1,10 +1,13 @@ +entered_characters = str() while 1: x = input("Введите число: ") if x.isdigit(): - print(x) - elif x.lower() in "stop": + entered_characters += x + elif x.lower() == "stop": print(x) break else: print(f"Введен не числовой символ: {x}") - continue \ No newline at end of file + +print(entered_characters) + diff --git a/Practice/i.golovchenko/L3.Practice2.py b/Practice/i.golovchenko/L3.Practice2.py index fd8c83b..8484778 100644 --- a/Practice/i.golovchenko/L3.Practice2.py +++ b/Practice/i.golovchenko/L3.Practice2.py @@ -1,8 +1,10 @@ +word = input("Введите слово: ") + def palindrome(a): - if a == a[::-1]: - return a[::-1] + if a.lower() == a[::-1].lower(): + return True else: - print(f"Введеное слово: {a} - не палидром") + return False -word = str(input("Введите слово: ")) -print(palindrome(word)) \ No newline at end of file +print(palindrome(word)) +print(type(word)) \ No newline at end of file From 4b2aefeb37dc7278ba90a339924b427a69082202 Mon Sep 17 00:00:00 2001 From: iana-golovchenko Date: Wed, 12 Jan 2022 23:20:44 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20=D1=87=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Practice/i.golovchenko/L3.Practice3.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Practice/i.golovchenko/L3.Practice3.py diff --git a/Practice/i.golovchenko/L3.Practice3.py b/Practice/i.golovchenko/L3.Practice3.py new file mode 100644 index 0000000..8387021 --- /dev/null +++ b/Practice/i.golovchenko/L3.Practice3.py @@ -0,0 +1,20 @@ +from random import randint + +y = int(input("Введи 1 число диапазона: ")) +z = int(input("Введи 2 число диапазона: ")) +x = randint(y, z) +while 1: #опять это while 1: - без которого не работает, но я не до конца понимаю как работает с ним) + print(f"Загаданное число: {x}") #еще без этой строчки скрипт работает не верно - я понимаю, что без нее у меня цикл не понимает что за х, но как корректно передать не понимаю + i = int(input("Введи число: ")) + if i > x: + print(f"Введенное число {i} больше загаданного") + elif i < x: + print(f"Введенное число {i} меньше загаданного") + else: + print("Победил") + break +# в общем я рещила сама задачу решить без подглядываний куда либо))) в чужой код, соблазн был поэтому много вопросов +# не могу сообразить как мне прикрутить условие "или не введет нечисловой символ, продолжать опрос" +# i = int(input("Введи число: ")) +# но если я убираю int то потом i строка не сравнивается с х = числом +# может сможете наводящими вопросами направить... \ No newline at end of file