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
5 changes: 5 additions & 0 deletions Урок 1. Практическое задание/task_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
Введите ваш возраст: 45
Ваши данные для входа в аккаунт: имя - Василий, пароль - vas, возраст - 45
"""

a = input('Впиши слово: ')
b = int(input('Впиши цифру: '))

print(a, ' ', b, ' ')
8 changes: 8 additions & 0 deletions Урок 1. Практическое задание/task_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@
Введите время в секундах: 3600
Время в формате ч:м:с - 1.0 : 60.0 : 3600
"""

seconds = int(input('Впиши секунды: '))
hours = seconds // 3600
seconds = seconds - hours * 3600
minutes = seconds // 60
seconds = seconds - minutes * 60

print(f'Time: {hours:02}:{minutes:02}:{seconds:02}')
8 changes: 8 additions & 0 deletions Урок 1. Практическое задание/task_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@
Введите число n: 3
n + nn + nnn = 369
"""

nubmer = input('Введите число: ')

second_number = nubmer+nubmer
third_number = nubmer+nubmer+nubmer

answer = int(nubmer) + int(second_number) + int(third_number)
print('Ответ: ', answer)
11 changes: 11 additions & 0 deletions Урок 1. Практическое задание/task_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@
Ведите целое положительное число: 123456789
Самая большая цифра в числе: 9
"""

number = int(input('Введите положительное число: '))

max = number % 10

while number > 0:
if number % 10 > max:
max = number % 10
number = number // 10

print('Максимальная цифра: ', max)
13 changes: 13 additions & 0 deletions Урок 1. Практическое задание/task_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@
Введите численность сотрудников фирмы: 10
Прибыль фирмы в расчете на одного сотрудника = 50.0
"""

revenue = float(input('Введите доход: '))
expenses = float(input('Введите издержки: '))

if revenue > expenses:
profit = revenue - expenses
print('Организация прибыльна')
employees = int(input('Введите число сотрудников: '))
print(f'Прибыль на сотрудника: {(profit/employees):.2f}')
elif revenue == expenses:
print('Доходы равны расходам')
else:
print('Организация не прибыльна')
11 changes: 11 additions & 0 deletions Урок 1. Практическое задание/task_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@
6-й день: 3,22
Ответ: на 6-й день спортсмен достиг результата — не менее 3 км.
"""

a = float(input('Расстояние первого дня: '))
b = float(input('Цель: '))
d = 1

while a < b:
a = a * 1.1
d += 1
print(f"День {d}: {a:.2f} км")

print(f'Цель достигнута на {d} день')
30 changes: 30 additions & 0 deletions Урок 7. Практическое задание/task_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,33 @@
8 10 12
14 16 18
"""


class Matrix:
def __init__(self, matrix_of_list):
self.matrix_of_list = matrix_of_list

def __add__(self, other):
my_list_3 = []
for i in range(0, len(self.matrix_of_list)):
my_list_4 = []
for j in range(0, len(self.matrix_of_list[0])):
my_list_4.append(self.matrix_of_list[i][j] + other.matrix_of_list[i][j])
my_list_3.append(my_list_4)
self.matrix_of_list = my_list_3
return Matrix(self.matrix_of_list)

def __str__(self):
for i in self.matrix_of_list:
for j in i:
print(j, end=" ")
print()
return ""


matrix_1 = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
matrix_2 = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print(matrix_1)
print(matrix_2)
matrix_3 = matrix_1 + matrix_2
print(matrix_3)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено

31 changes: 31 additions & 0 deletions Урок 7. Практическое задание/task_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,34 @@

Два класса: абстрактный и Clothes
"""

from abc import ABC, abstractmethod


class Absclothes(ABC):
@abstractmethod
def coat(self):
pass

@abstractmethod
def suit(self):
pass


class Clothes(Absclothes):
def __init__(self, v, h):
self.v = v
self.h = h

def coat(self):
return round(self.v / 6.5 + 0.5, 1)

@property
def suit(self):
return round(2 * self.h + 0.3, 1)


clothes = Clothes(17, 5)
print(f'Расход ткани на пальто = {clothes.coat()}')
print(f'Расход ткани на костюм = {clothes.suit}')
print(f'Общий расход = {clothes.coat() + clothes.suit}')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено

64 changes: 64 additions & 0 deletions Урок 7. Практическое задание/task_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,67 @@
*****\n *****\n *****\n *****\n *****\n *****\n
**********\n **********\n *****
"""


class Cell:
def __init__(self, quantity):
self.quantity = int(quantity)

def __str__(self):
return f'({self.quantity})'

def __add__(self, other):
return f'Сумма клеток = {str(Cell(self.quantity + other.quantity))}'

def __sub__(self, other):
if (self.quantity - other.quantity) > 0:
return f'Разность клеток = {Cell(int(self.quantity - other.quantity))}'
return f'Разность отрицательна, поэтому операция не выполняется'

def __mul__(self, other):
return f'Умножение клеток = {Cell(int(self.quantity * other.quantity))}'

def __truediv__(self, other):
return f'Деление клеток = {Cell(round(self.quantity // other.quantity))}'

def make_order(self, cells_count):
row = ''
for _ in range(int(self.quantity / cells_count)):
row += f'{"*" * cells_count}\\n '
row += f'{"*" * (self.quantity % cells_count)}'
return row


print("Создаем объекты клеток")
cell1 = Cell(30)
cell2 = Cell(25)

cell3 = Cell(10)
cell4 = Cell(15)

print()

print("Складываем")
print(cell1 + cell2)

print()

print("Вычитаем")
print(cell2 - cell1)
print(cell4 - cell3)

print()

print("Умножаем")
print(cell2 * cell1)

print()

print("Делим")
print(cell1 / cell2)

print()

print("Организация ячеек по рядам")
print(cell1.make_order(5))
print(cell2.make_order(10))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

выполнено