This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1st program | |
| print(9 ** 0.5 * 5) | |
| # 2nd program | |
| print(9.99 > 9.98 and 1000 != 1000.1) | |
| #3rd program | |
| print((1234 % 1000)//10+(5678 % 1000)//10) | |
| #4th program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Horse: | |
| ''' | |
| Класс описывающий лошадь | |
| ''' | |
| def __init__(self): | |
| self.x_distance = 0 # пройденный путь. | |
| self.sound = 'Frrr' # звук, который издаёт лошадь. | |
| def run(self, dx): # изменение дистанции на значение dx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Horse: | |
| ''' | |
| Класс описывающий лошадь | |
| ''' | |
| def __init__(self): | |
| self.x_distance = 0 # пройденный путь. | |
| self.sound = 'Frrr' # звук, который издаёт лошадь. | |
| def run(self, dx): # изменение дистанции на значение dx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Horse: | |
| ''' | |
| Класс описывающий лошадь | |
| ''' | |
| def __init__(self, y_distance): | |
| self.x_distance = 0 # пройденный путь. | |
| self.sound = 'Frrr' # звук, который издаёт лошадь. | |
| super().__init__(y_distance) | |
| super().fly() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Vehicle: | |
| __COLOR_VARIANTS = ['blue', 'red', 'green', 'black', 'white'] # Доступные цвета | |
| def __init__(self, owner: str, __model: str, __color: str, __engine_power: int): | |
| self.owner = owner # владелец транспорта. (владелец может меняться) | |
| self.__model = __model # модель (марка) транспорта. (мы не можем менять) | |
| self.__engine_power = __engine_power # мощность двигателя. (мы не можем менять) | |
| self.__color = __color # название цвета. (мы не можем менять) | |
| def get_model(self): # Вернуть модель транспорта |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Animal: | |
| ''' | |
| Родительсский класс Животные | |
| ''' | |
| def __init__(self, name): | |
| self.alive = True # Живой | |
| self.fed = False # Накормленный | |
| self.name = name # Название животного |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| class User: | |
| ''' | |
| Класс для преобразования данных о пользователе | |
| ''' | |
| def __init__(self, nickname, password, age): | |
| self.nickname = nickname # Имя пользователя |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| class User: | |
| ''' | |
| Класс для преобразования данных о пользователе | |
| ''' | |
| def __init__(self, nickname, password, age): | |
| self.nickname = nickname # Имя пользователя |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def type_int(value, num): # Функция для проверки типа данных | |
| def break_code(numb): | |
| return num if isinstance(numb, int) else False | |
| if not break_code(num): | |
| print(f''' | |
| Выполнение программы прервано: | |
| В качестве количесnва этажей | |
| передано значение "{num}" => {type(num)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def type_int(value, num): # Функция для проверки типа данных | |
| def break_code(numb): | |
| return num if isinstance(numb, int) else False | |
| if not break_code(num): | |
| print(f''' | |
| Выполнение программы прервано: | |
| В качестве количесnва этажей | |
| передано значение "{num}" => {type(num)} |
NewerOlder