diff --git a/Practice/i.golovchenko/L2.Practice3.py b/Practice/i.golovchenko/L2.Practice3.py new file mode 100644 index 0000000..9bc29cd --- /dev/null +++ b/Practice/i.golovchenko/L2.Practice3.py @@ -0,0 +1,35 @@ +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() diff --git a/Practice/i.golovchenko/L3.Practice1.py b/Practice/i.golovchenko/L3.Practice1.py new file mode 100644 index 0000000..b13c693 --- /dev/null +++ b/Practice/i.golovchenko/L3.Practice1.py @@ -0,0 +1,13 @@ +entered_characters = str() +while 1: + x = input("Введите число: ") + if x.isdigit(): + entered_characters += x + elif x.lower() == "stop": + print(x) + break + else: + print(f"Введен не числовой символ: {x}") + +print(entered_characters) + diff --git a/Practice/i.golovchenko/L3.Practice2.py b/Practice/i.golovchenko/L3.Practice2.py new file mode 100644 index 0000000..8484778 --- /dev/null +++ b/Practice/i.golovchenko/L3.Practice2.py @@ -0,0 +1,10 @@ +word = input("Введите слово: ") + +def palindrome(a): + if a.lower() == a[::-1].lower(): + return True + else: + return False + +print(palindrome(word)) +print(type(word)) \ No newline at end of file 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