Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Address:

def __init__(self, postal_code, city, street, house, apartment):

self.postal_code = postal_code
self.city = city
self.street = street
self.house = house
self.apartment = apartment
7 changes: 7 additions & 0 deletions lesson_3_task_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from user import User

my_user = User("Кямал", "Алиев")

my_user.print_first_name()
my_user.print_last_name()
my_user.print_full_name()
12 changes: 12 additions & 0 deletions lesson_3_task_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from smartphone import Smartphone

catalog = []

catalog.append(Smartphone("Samsung", "Galaxy S23", "+79123456789"))
catalog.append(Smartphone("Apple", "iPhone 15", "+79998887766"))
catalog.append(Smartphone("Xiaomi", "Redmi Note 12", "+79001112233"))
catalog.append(Smartphone("Google", "Pixel 7", "+79223334455"))
catalog.append(Smartphone("OnePlus", "11 Pro", "+79335556677"))

for phone in catalog:
print(f"{phone.brand} - {phone.model}. {phone.phone_number}")
16 changes: 16 additions & 0 deletions lesson_3_task_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from address import Address
from mailing import Mailing

from_address = Address("123456", "Москва", "Тверская", "10", "25")
to_address = Address("654321", "Санкт-Петербург", "Невский", "20", "50")

mailing = Mailing(to_address, from_address, 500.50, "TRACK12345ABC")

output_string = (
f"Отправление {mailing.track} из {mailing.from_address.postal_code}, {mailing.from_address.city}, "
f"{mailing.from_address.street}, {mailing.from_address.house} - {mailing.from_address.apartment} в "
f"{mailing.to_address.postal_code}, {mailing.to_address.city}, {mailing.to_address.street}, "
f"{mailing.to_address.house} - {mailing.to_address.apartment}. Стоимость {mailing.cost} рублей."
)

print(output_string)
9 changes: 9 additions & 0 deletions mailing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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 = cost
self.track = track
7 changes: 7 additions & 0 deletions smartphone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Smartphone:

def __init__(self, brand, model, phone_number):

self.brand = brand
self.model = model
self.phone_number = phone_number
17 changes: 17 additions & 0 deletions user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class User:

def __init__(self, first_name, last_name):

self.first_name = first_name
self.last_name = last_name

def print_first_name(self):

print(self.first_name)

def print_last_name(self):

print(self.last_name)

def print_full_name(self):
print(f"{self.first_name} {self.last_name}")