From 78f5178855f8c77d340cd6c6efdb15e2fb93dcc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mike985-=D0=BC=D0=B0=D0=B9=D0=BA=20985?= Date: Sun, 12 Oct 2025 15:46:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20lesson3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03_lesson/address.py | 10 ++++++++++ 03_lesson/lesson_3_task_1.py | 7 +++++++ 03_lesson/lesson_3_task_2.py | 12 ++++++++++++ 03_lesson/lesson_3_task_3.py | 9 +++++++++ 03_lesson/mailing.py | 11 +++++++++++ 03_lesson/smartphone.py | 5 +++++ 03_lesson/user.py | 13 +++++++++++++ 7 files changed, 67 insertions(+) create mode 100644 03_lesson/address.py create mode 100644 03_lesson/lesson_3_task_1.py create mode 100644 03_lesson/lesson_3_task_2.py create mode 100644 03_lesson/lesson_3_task_3.py create mode 100644 03_lesson/mailing.py create mode 100644 03_lesson/smartphone.py create mode 100644 03_lesson/user.py diff --git a/03_lesson/address.py b/03_lesson/address.py new file mode 100644 index 0000000..5f599d4 --- /dev/null +++ b/03_lesson/address.py @@ -0,0 +1,10 @@ +class Address: + def __init__(self, index, city, street, house, flat ): + self.index = index + self.city = city + self.street = street + self.house = house + self.flat = flat + + def __str__(self): + return f"{self.index}, {self.city}, {self.street}, {self.house} - {self.flat}" \ No newline at end of file diff --git a/03_lesson/lesson_3_task_1.py b/03_lesson/lesson_3_task_1.py new file mode 100644 index 0000000..277afae --- /dev/null +++ b/03_lesson/lesson_3_task_1.py @@ -0,0 +1,7 @@ +from user import User + +my_user = User("Михаил", "Михалыч") + +my_user.get_first_name() +my_user.get_last_name() +my_user.get_First_last_info() \ No newline at end of file diff --git a/03_lesson/lesson_3_task_2.py b/03_lesson/lesson_3_task_2.py new file mode 100644 index 0000000..a02228b --- /dev/null +++ b/03_lesson/lesson_3_task_2.py @@ -0,0 +1,12 @@ +from smartphone import Smartphone + +catalog = [ + Smartphone("Samsung", "Galaxy S21", "+79242718265"), + Smartphone("Samsung", "Galaxy S22", "+79242718264"), + Smartphone("Samsung", "Galaxy S23", "+79242718263"), + Smartphone("Samsung", "Galaxy S24", "+79242718262"), + Smartphone("Samsung", "Galaxy S25", "+79242718261") +] + +for smartphone in catalog: + print(f"{smartphone.phone_brand} - {smartphone.phone_model} - {smartphone.subscription_number}") \ No newline at end of file diff --git a/03_lesson/lesson_3_task_3.py b/03_lesson/lesson_3_task_3.py new file mode 100644 index 0000000..eb75281 --- /dev/null +++ b/03_lesson/lesson_3_task_3.py @@ -0,0 +1,9 @@ +from address import Address +from mailing import Mailing + +to_address = Address(751, "Питер", "Ленина", 1, 1) +from_address = Address(752, "Москва", "Ленина", 2, 2) + +mailing = Mailing(from_address, to_address, 500, "12") + +print(mailing) \ No newline at end of file diff --git a/03_lesson/mailing.py b/03_lesson/mailing.py new file mode 100644 index 0000000..4ee7713 --- /dev/null +++ b/03_lesson/mailing.py @@ -0,0 +1,11 @@ +from address import Address + +class Mailing: + def __init__(self, to_address, from_address, cost, track): + self.to_address = to_address + self.from_address = from_address + self.cost = 500 + self.track = 12 + + def __str__(self): + return f"Отправление {self.track} из {self.from_address} в {self.to_address}. Стоимость {self.cost} рублей." \ No newline at end of file diff --git a/03_lesson/smartphone.py b/03_lesson/smartphone.py new file mode 100644 index 0000000..c2b4c7a --- /dev/null +++ b/03_lesson/smartphone.py @@ -0,0 +1,5 @@ +class Smartphone: + def __init__(self, phone_brand, phone_model, subscription_number): + self.phone_brand = phone_brand + self.phone_model = phone_model + self.subscription_number = subscription_number \ No newline at end of file diff --git a/03_lesson/user.py b/03_lesson/user.py new file mode 100644 index 0000000..d66b7e6 --- /dev/null +++ b/03_lesson/user.py @@ -0,0 +1,13 @@ +class User: + def __init__(self, first_name, last_name): + self.first_name = first_name + self.last_name = last_name + + def get_first_name(self): + print(self.first_name) + + def get_last_name(self): + print(self.last_name) + + def get_First_last_info(self): + print(f"First_name: {self.first_name}, Last_name: {self.last_name}") \ No newline at end of file