diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d56657a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..2572635
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/.idea/\320\236\321\201\320\275\320\276\320\262\321\213.iml" "b/.idea/\320\236\321\201\320\275\320\276\320\262\321\213.iml"
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ "b/.idea/\320\236\321\201\320\275\320\276\320\262\321\213.iml"
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lesson_5/L5_T4.txt b/Lesson_5/L5_T4.txt
new file mode 100644
index 0000000..48de98b
--- /dev/null
+++ b/Lesson_5/L5_T4.txt
@@ -0,0 +1,4 @@
+One - 1
+Two - 2
+Three - 3
+Four - 4
\ No newline at end of file
diff --git a/Lesson_5/L5_T4_1.txt b/Lesson_5/L5_T4_1.txt
new file mode 100644
index 0000000..8d7d0ba
--- /dev/null
+++ b/Lesson_5/L5_T4_1.txt
@@ -0,0 +1,4 @@
+Один- 1
+Два- 2
+Три- 3
+Четыре- 4
\ No newline at end of file
diff --git a/Lesson_5/L5_T5.txt b/Lesson_5/L5_T5.txt
new file mode 100644
index 0000000..a498169
--- /dev/null
+++ b/Lesson_5/L5_T5.txt
@@ -0,0 +1 @@
+3 33
\ No newline at end of file
diff --git a/Lesson_5/L5_T6.py b/Lesson_5/L5_T6.py
new file mode 100644
index 0000000..9568cde
--- /dev/null
+++ b/Lesson_5/L5_T6.py
@@ -0,0 +1,58 @@
+# Необходимо создать (не программно) текстовый файл,
+# где каждая строка описывает учебный предмет и наличие лекционных, практических и лабораторных занятий
+# по этому предмету и их количество.
+# Важно, чтобы для каждого предмета не обязательно были все типы занятий.
+# Сформировать словарь, содержащий название предмета и общее количество занятий по нему.
+# Вывести словарь на экран.
+# Примеры строк файла:
+# Информатика: 100(л) 50(пр) 20(лаб).
+# Физика: 30(л) — 10(лаб)
+# Физкультура: — 30(пр) —
+#
+# Пример словаря:
+# {“Информатика”: 170, “Физика”: 40, “Физкультура”: 30}
+
+d = {}
+with open('Les5_T6.txt', 'r', encoding='UTF-8') as f_obj:
+ while True:
+ s=0
+ f_obj_line=f_obj.readline()
+ if not f_obj_line:
+ break
+ key_value = f_obj_line.split(" ")
+ for i in key_value[1:]:
+ j=''
+ for x in range(len(i)):
+ if i[x].isdigit():
+ j+=i[x]
+ if j != '':
+ s+= int(j)
+ d[key_value[0][0:-1]] = s
+print(d)
+
+
+
+ # for line in f_obj_line:
+ # key_value = line.split(" ")
+ # value = 0
+ # for i in d:
+ # list=d(i)
+ # if i.isdigit():
+ # value+=i
+ # else:
+ # break
+ # for j in sum_value:
+ # s_value+= sum_value(j)
+ # print(s_value)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Lesson_5/L5_T7.py b/Lesson_5/L5_T7.py
new file mode 100644
index 0000000..4069255
--- /dev/null
+++ b/Lesson_5/L5_T7.py
@@ -0,0 +1,34 @@
+# 7. Создать (не программно) текстовый файл, в котором каждая строка должна содержать данные о фирме:
+# название, форма собственности, выручка, издержки.
+# Пример строки файла: firm_1 ООО 10000 5000.
+# Необходимо построчно прочитать файл, вычислить прибыль каждой компании, а также среднюю прибыль.
+# Если фирма получила убытки, в расчет средней прибыли ее не включать.
+# Далее реализовать список. Он должен содержать словарь с фирмами и их прибылями, а также словарь со средней прибылью. Если фирма получила убытки, также добавить ее в словарь (со значением убытков).
+# Пример списка: [{“firm_1”: 5000, “firm_2”: 3000, “firm_3”: 1000}, {“average_profit”: 2000}].
+# Итоговый список сохранить в виде json-объекта в соответствующий файл.
+# Пример json-объекта:
+# [{"firm_1": 5000, "firm_2": 3000, "firm_3": 1000}, {"average_profit": 2000}]
+#
+# Подсказка: использовать менеджеры контекста.
+
+import json
+
+list1={}
+med_prft={}
+rev=0
+costs=0
+with open('Les5_t7.txt','r', encoding='UTF-8') as f_obj:
+ while True:
+ my_file = f_obj.readline().split()
+ if not my_file:
+ break
+ prft = int(my_file[2]) - int(my_file[3])
+ if prft>0:
+ rev+=1
+ costs += prft
+ list1[my_file[0]]=prft
+med_prft=costs/rev
+result = [list1, med_prft]
+print(result)
+with open("result.json", 'w', encoding='utf-8') as f_obj:
+ json.dump(result, f_obj)
diff --git a/Lesson_5/L5_t3.txt b/Lesson_5/L5_t3.txt
new file mode 100644
index 0000000..65e23cf
--- /dev/null
+++ b/Lesson_5/L5_t3.txt
@@ -0,0 +1,10 @@
+Иванов 15245.23
+Петров 56325.35
+Чирков 95354.23
+Сидоров 56353.22
+Задорнов 18321.44
+Алексеев 62354.12
+Сергеев 35543.32
+Александров 35435.24
+Владимиров 36533.24
+Смирнов 16355.6
diff --git a/Lesson_5/Les5_T5.py b/Lesson_5/Les5_T5.py
new file mode 100644
index 0000000..d5f1eff
--- /dev/null
+++ b/Lesson_5/Les5_T5.py
@@ -0,0 +1,18 @@
+# Создать (программно) текстовый файл, записать в него программно набор чисел,
+# разделенных пробелами. Программа должна подсчитывать сумму чисел в файле и
+# выводить ее на экран.
+
+def num(string):
+ total = 0
+ for number in string:
+ total += int(number)
+ return total
+my_file = open('L5_T5.txt', 'w+')
+my_list = input("Введите числа через пробел:")
+my_file.write(my_list)
+my_file.seek(0)
+my_list1 = my_file.read()
+my_list2=my_list1.split(' ')
+print(num(my_list2))
+
+my_file.close()
diff --git a/Lesson_5/Les5_T6.txt b/Lesson_5/Les5_T6.txt
new file mode 100644
index 0000000..b2b260e
--- /dev/null
+++ b/Lesson_5/Les5_T6.txt
@@ -0,0 +1,3 @@
+Информатика: 100(л) 70(пр) 40(лаб).
+Физика: 70(л) — 90(лаб)
+Физкультура: — 40(пр) —
\ No newline at end of file
diff --git a/Lesson_5/Les5_Task1.py b/Lesson_5/Les5_Task1.py
new file mode 100644
index 0000000..5f5382d
--- /dev/null
+++ b/Lesson_5/Les5_Task1.py
@@ -0,0 +1,8 @@
+
+with open("text.txt", 'r') as file_obj:
+ content = file_obj.read()
+ end = ()
+ print(content)
+ for i in content:
+ print(i)
+
diff --git a/Lesson_5/Les5_Task2.py b/Lesson_5/Les5_Task2.py
new file mode 100644
index 0000000..4053b2b
--- /dev/null
+++ b/Lesson_5/Les5_Task2.py
@@ -0,0 +1,11 @@
+
+with open("text.txt", 'r') as file_obj:
+ content = (file_obj.readlines())
+ print('В файле Text',len(content),'строк')
+ for i in range(len(content)):
+ content_1 = content[i].split()
+ print('В', i + 1,'строке', len(content_1), 'слов(а)')
+ print(content)
+
+
+
diff --git a/Lesson_5/Les5_Task3.py b/Lesson_5/Les5_Task3.py
new file mode 100644
index 0000000..979ecb7
--- /dev/null
+++ b/Lesson_5/Les5_Task3.py
@@ -0,0 +1,18 @@
+with open('L5_t3.txt', 'r', encoding='UTF-8') as my_file:
+ i = 0
+ s = 0
+ print('Список сотрудников с окладом менее 20000:')
+ while True:
+ my_list = my_file.readline()
+ if not my_list:
+ break
+ if float(my_list.split(' ')[1]) < 20000:
+ print(my_list.split(' ')[0])
+ s += float(my_list.split(' ')[1])
+ i += 1
+
+ print('Средняя заработная плата сотрудников:', s/i)
+
+
+
+
diff --git a/Lesson_5/Les5_Task4.py b/Lesson_5/Les5_Task4.py
new file mode 100644
index 0000000..5585273
--- /dev/null
+++ b/Lesson_5/Les5_Task4.py
@@ -0,0 +1,14 @@
+with open('L5_T4.txt', encoding='UTF-8') as f_obj:
+ for line in f_obj:
+ print(line)
+rus_dict = {'One' : 'Один', 'Two' : 'Два', 'Three' : 'Три', 'Four' : 'Четыре'}
+new_dict = []
+with open('L5_T4.txt') as f_obj:
+ for i in f_obj:
+ i = i.split(' ', 1)
+ new_dict.append(rus_dict[i[0]] + i[1])
+ print(new_dict)
+
+with open('L5_T4_1.txt', 'w', encoding='UTF-8') as file_obj_1:
+ file_obj_1.writelines(new_dict)
+
diff --git a/Lesson_5/Les5_t7.txt b/Lesson_5/Les5_t7.txt
new file mode 100644
index 0000000..f0adb3b
--- /dev/null
+++ b/Lesson_5/Les5_t7.txt
@@ -0,0 +1,3 @@
+firm_1 OOO 10000 4000
+firm_2 OOO 30000 200000
+firm_3 OOO 20000 50000
diff --git a/Lesson_5/Text.txt b/Lesson_5/Text.txt
new file mode 100644
index 0000000..60ca598
--- /dev/null
+++ b/Lesson_5/Text.txt
@@ -0,0 +1,7 @@
+Hello!
+My name is Olesia
+I am studying at the online university "Geek Brains"
+bla-bla
+bla bla bla
+bla
+bla-bla, bla, bla
diff --git a/Lesson_5/file_4_new.txt b/Lesson_5/file_4_new.txt
new file mode 100644
index 0000000..9329294
--- /dev/null
+++ b/Lesson_5/file_4_new.txt
@@ -0,0 +1,4 @@
+���� - 1
+��� - 2
+��� - 3
+������ - 4
\ No newline at end of file
diff --git a/Lesson_5/result.json b/Lesson_5/result.json
new file mode 100644
index 0000000..aed233d
--- /dev/null
+++ b/Lesson_5/result.json
@@ -0,0 +1 @@
+[{"firm_1": 6000, "firm_2": -170000, "firm_3": -30000}, 6000.0]
\ No newline at end of file
diff --git a/Lesson_6/Les6_Task1.py b/Lesson_6/Les6_Task1.py
new file mode 100644
index 0000000..55573cb
--- /dev/null
+++ b/Lesson_6/Les6_Task1.py
@@ -0,0 +1,18 @@
+from time import sleep
+
+class TrafficLight:
+ colors = ('red', 'yellow', 'green')
+ time = (7, 2, 5)
+
+ def __init__(self):
+ self.__color= 'red'
+
+ def running(self):
+ for i in self.colors:
+ self.__color = i
+ print(self.__color)
+ sleep(self.time[self.colors.index(self.__color)])
+
+traffic = TrafficLight()
+traffic.running()
+
diff --git a/Lesson_6/Les6_Task2.py b/Lesson_6/Les6_Task2.py
new file mode 100644
index 0000000..6ecf238
--- /dev/null
+++ b/Lesson_6/Les6_Task2.py
@@ -0,0 +1,17 @@
+# Реализовать класс Road (дорога), в котором определить атрибуты:
+# length (длина), width (ширина). Значения данных атрибутов должны передаваться при создании
+# экземпляра класса. Атрибуты сделать защищенными. Определить метод расчета массы асфальта,
+# необходимого для покрытия всего дорожного полотна. Использовать формулу:
+# длина * ширина * масса асфальта для покрытия одного кв метра дороги асфальтом,
+# # толщиной в 1 см * чи сло см толщины полотна. Проверить работу метода.
+
+class Road:
+ def __init__(self, lenght, widht):
+ self._lenght = lenght
+ self._widht = widht
+
+ def get_weight(self, mass, layer):
+ return self._lenght* self._widht * mass * layer/1000
+
+m = Road(100, 4)
+print(m.get_weight(0.145, 6))
diff --git a/Lesson_6/Les6_Task5.py b/Lesson_6/Les6_Task5.py
new file mode 100644
index 0000000..5fc1444
--- /dev/null
+++ b/Lesson_6/Les6_Task5.py
@@ -0,0 +1,32 @@
+# Реализовать класс Stationery (канцелярская принадлежность).
+# Определить в нем атрибут title (название) и метод draw (отрисовка).
+# Метод выводит сообщение “Запуск отрисовки.” Создать три дочерних класса Pen (ручка), Pencil (карандаш),
+# Handle (маркер). В каждом из классов реализовать переопределение метода draw.
+# Для каждого из классов методы должен выводить уникальное сообщение.
+# Создать экземпляры классов и проверить, что выведет описанный метод для каждого экземпляра.
+
+class Stationery:
+ def __init__(self, title):
+ self.title = title
+
+ def draw(self):
+ print('Запуск отрисовки')
+
+class Pen(Stationery):
+ def draw(self):
+ print('Рисовать ручкой', self.title)
+
+class Pensil(Stationery):
+ def draw(self):
+ print('Рисовать карандашом', self.title)
+
+class Handle(Stationery):
+ def draw(self):
+ print('Рисовать маркером', self.title)
+
+pen_1 = Pen('Линия 0,7 мм')
+pensil_1 = Pensil('Линия 2 мм')
+handle_1 = Handle('Линия 4 мм')
+
+for i in (pen_1, pensil_1, handle_1):
+ i.draw()
diff --git a/Lesson_6/Less6_Task3.py b/Lesson_6/Less6_Task3.py
new file mode 100644
index 0000000..aa5a8a4
--- /dev/null
+++ b/Lesson_6/Less6_Task3.py
@@ -0,0 +1,38 @@
+# Реализовать базовый класс Worker (работник), в котором определить атрибуты:
+# name, surname, position (должность), income (доход). Последний атрибут должен быть защищенным
+# и ссылаться на словарь, содержащий элементы: оклад и премия, например,
+# {"wage": wage, "bonus": bonus}. Создать класс Position (должность) на базе класса Worker.
+# В классе Position реализовать методы получения полного имени сотрудника (get_full_name) и дохода
+# с учетом премии (get_total_income). Проверить работу примера на реальных данных
+# (создать экземпляры класса Position, передать данные, проверить значения атрибутов, вызвать методы экземпляров).
+
+class Worker:
+ def __init__(self, name, surname, position, wage, bonus):
+ self.name = name # создаем атрибут(self.title) и передаем значение(title)
+ self.surname = surname
+ self.position = position
+ self._income = {"wage": wage, "bonus": bonus}
+
+class Position(Worker):
+
+ def get_full_name(self):
+ return self.name, self.surname
+
+ def get_total_income(self):
+ return self._income['wage']+self._income['bonus']
+
+worker_1 = Position('Иван', 'Иванов', 'Менеджер', 50000, 10000)
+
+print(worker_1.position, worker_1.get_full_name(),worker_1.get_total_income())
+
+# print(worker_1.name)
+# print(worker_1.surname)
+# print(worker_1.position)
+# print(worker_1.get_full_name())
+# print(worker_1.get_total_income())
+
+
+
+
+
+
diff --git a/Lesson_6/Less6_Task4.py b/Lesson_6/Less6_Task4.py
new file mode 100644
index 0000000..c9c3c97
--- /dev/null
+++ b/Lesson_6/Less6_Task4.py
@@ -0,0 +1,65 @@
+# Реализуйте базовый класс Car. У данного класса должны быть следующие атрибуты:
+# speed, color, name, is_police (булево). А также методы: go, stop, turn(direction),
+# которые должны сообщать, что машина поехала, остановилась, повернула (куда).
+# Опишите несколько дочерних классов: TownCar, SportCar, WorkCar, PoliceCar. Добавьте в базовый класс метод show_speed,
+# который должен показывать текущую скорость автомобиля. Для классов TownCar и WorkCar переопределите метод show_speed.
+# При значении скорости свыше 60 (TownCar) и 40 (WorkCar) должно выводиться сообщение о превышении скорости.
+# Создайте экземпляры классов, передайте значения атрибутов.
+# Выполните доступ к атрибутам, выведите результат. Выполните вызов методов и также покажите результат.
+
+class Car:
+ def __init__(self, speed, color, name, is_police=False):
+ self.speed = speed
+ self.color = color
+ self.name = name
+ self.is_police = is_police
+ def go(self):
+ print('Go!')
+ def stop(self):
+ print('stop')
+ def turn(self, direction):
+ print({direction})
+ def show_speed(self):
+ print(self.speed)
+
+class TownCar(Car):
+ def show_speed(self):
+ if self.speed >60:
+ print('Превышение скорости!')
+
+class SportCar(Car):
+ print('')
+
+
+class WorkCar(Car):
+ def show_speed(self):
+ if self.speed >40:
+ print('Превышение скорости!')
+
+class PoliceCar(Car):
+ def __init__(self, speed, color, name, is_police=True):
+ self.speed = speed
+ self.color = color
+ self.name = name
+ self.is_police = is_police
+
+
+TownCar_1=TownCar(90, 'red', 'Kia')
+SportCar_1=SportCar(180, 'Black', 'Ferrari')
+WorkCar_1=WorkCar(140, 'White', 'Gaz')
+PoliceCar_1=PoliceCar(60, 'Blue', 'Toyota')
+
+
+print(TownCar_1.name,TownCar_1.speed, TownCar_1.color,TownCar_1.is_police)
+TownCar_1.show_speed()
+TownCar_1.stop()
+
+print(SportCar_1.name, SportCar_1.speed, SportCar_1.color, SportCar_1.is_police)
+SportCar_1.turn('Прямо')
+
+print(WorkCar_1.name, WorkCar_1.speed,WorkCar_1.color, WorkCar_1.is_police)
+WorkCar_1.show_speed()
+WorkCar_1.turn('Направо')
+
+print(PoliceCar_1.name, PoliceCar_1.speed,PoliceCar_1.color, PoliceCar_1.is_police)
+PoliceCar_1.turn('Налево')