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
10 changes: 10 additions & 0 deletions 03_lesson/address.py
Original file line number Diff line number Diff line change
@@ -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}"
7 changes: 7 additions & 0 deletions 03_lesson/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.get_first_name()
my_user.get_last_name()
my_user.get_First_last_info()
12 changes: 12 additions & 0 deletions 03_lesson/lesson_3_task_2.py
Original file line number Diff line number Diff line change
@@ -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}")
9 changes: 9 additions & 0 deletions 03_lesson/lesson_3_task_3.py
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions 03_lesson/mailing.py
Original file line number Diff line number Diff line change
@@ -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} рублей."
5 changes: 5 additions & 0 deletions 03_lesson/smartphone.py
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions 03_lesson/user.py
Original file line number Diff line number Diff line change
@@ -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}")