diff --git a/LearnPython/Ch11/__pycache__/task11.cpython-311.pyc b/LearnPython/Ch11/__pycache__/task11.cpython-311.pyc new file mode 100644 index 0000000..18dab5f Binary files /dev/null and b/LearnPython/Ch11/__pycache__/task11.cpython-311.pyc differ diff --git a/LearnPython/Ch11/task11.py b/LearnPython/Ch11/task11.py new file mode 100644 index 0000000..4d1a737 --- /dev/null +++ b/LearnPython/Ch11/task11.py @@ -0,0 +1,12 @@ + + + +class Employee(): + + def __init__(self, first_name, last_name, salary_of_year): + self.first_name = first_name + self.last_name = last_name + self.salary_of_year = salary_of_year + + def give_raise(self, increment_of_salary=5000): + self.salary_of_year += increment_of_salary diff --git a/LearnPython/Ch11/test11.py b/LearnPython/Ch11/test11.py new file mode 100644 index 0000000..642291c --- /dev/null +++ b/LearnPython/Ch11/test11.py @@ -0,0 +1,21 @@ +import unittest +from task11 import Employee + + +class TestEmployee(unittest.TestCase): + '''Класс для тестирования класса Employee''' + + def setUp(self): + self.my_employee = Employee('Renal', 'Gayazov', 30000) + + def test_give_default_raise(self): + self.my_employee.give_raise() + self.assertEqual(self.my_employee.salary_of_year, 35000) + + def test_give_custom_raise(self): + self.my_employee.give_raise(9000) + self.assertEqual(self.my_employee.salary_of_year, 39000) + +if __name__ == '__main__': + unittest.main() + diff --git a/LearnPython/other/answer.json b/LearnPython/other/answer.json new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/LearnPython/other/answer.json @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/LearnPython/other/fact.py b/LearnPython/other/fact.py new file mode 100644 index 0000000..a5024df --- /dev/null +++ b/LearnPython/other/fact.py @@ -0,0 +1,17 @@ +import unittest + +def fact(x): + if(x==1): + return 1 + else: + return x*fact(x-1) + +class FactTest(unittest.TestCase): + '''Проверка функции факториала''' + + def test_5_fact(self): + ans = fact(5) + self.assertEqual(ans, 120) + + +unittest.main() \ No newline at end of file diff --git a/LearnPython/other/number.json b/LearnPython/other/number.json new file mode 100644 index 0000000..eafc800 --- /dev/null +++ b/LearnPython/other/number.json @@ -0,0 +1 @@ +[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] \ No newline at end of file diff --git a/LearnPython/other/tasks.py b/LearnPython/other/tasks.py new file mode 100644 index 0000000..503b4f7 --- /dev/null +++ b/LearnPython/other/tasks.py @@ -0,0 +1,26 @@ +import json +import unittest + +def input_digit(): + try: + with open('answer.json') as f: + x = json.load(f) + print(f'Ваше любимое число: {x}') + except FileNotFoundError: + x = int(input('Введите ваше любимое число: ')) + with open('answer.json', 'w') as f: + json.dump(x, f) + + +def output_digit(): + with open('answer.json') as f: + x = json.load(f) + print(f'Ваше любимое число: {x}') + +input_digit() + +output_digit() + +class InputTest(unittest.TestCase): + '''Тесты для функции ввода с клавиатуры''' + def test_ \ No newline at end of file diff --git a/hub/anna.py b/hub/anna.py new file mode 100644 index 0000000..28cba15 --- /dev/null +++ b/hub/anna.py @@ -0,0 +1,6 @@ +import json + +with open('hub\data.json') as f: + data = json.load(f) + +print(data["events_data"][0]['id']) \ No newline at end of file diff --git a/hub/data.json b/hub/data.json new file mode 100644 index 0000000..c5ac46b --- /dev/null +++ b/hub/data.json @@ -0,0 +1 @@ +{"events_data": [{"id": 47946124, "client_id": 62526, "user_id": 110777, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 47947076, "client_id": 61944, "user_id": 108565, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 47962056, "client_id": 27115, "user_id": 49440, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 47962120, "client_id": 27115, "user_id": 49440, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-31 23:59:59", "startDate": "2019-03-25 00:00:00"}}, {"id": 47962218, "client_id": 27115, "user_id": 49440, "category": "table", "action": "sort", "options": {"dir": "ASC", "name": "deal_date"}}, {"id": 47962238, "client_id": 27115, "user_id": 49440, "category": "table", "action": "sort", "options": {"dir": "DESC", "name": "deal_date"}}, {"id": 47962532, "client_id": 27115, "user_id": 49440, "category": "table", "action": "sort", "options": {"dir": "ASC", "name": "deal_date"}}, {"id": 47962534, "client_id": 27115, "user_id": 49440, "category": "table", "action": "sort", "options": {"dir": "DESC", "name": "deal_date"}}, {"id": 47962696, "client_id": 27115, "user_id": 49440, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-10 23:59:59", "startDate": "2019-03-04 00:00:00"}}, {"id": 47962748, "client_id": 27115, "user_id": 49440, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-02-24 23:59:59", "startDate": "2019-02-18 00:00:00"}}, {"id": 47962830, "client_id": 27115, "user_id": 49440, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-31 23:59:59", "startDate": "2019-03-25 00:00:00"}}, {"id": 47962860, "client_id": 27115, "user_id": 49440, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-31 23:59:59", "startDate": "2019-03-28 00:00:00"}}, {"id": 47962952, "client_id": 27115, "user_id": 49440, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-31 23:59:59", "startDate": "2019-03-29 00:00:00"}}, {"id": 47964366, "client_id": 62017, "user_id": 108835, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 47989384, "client_id": 63120, "user_id": 113069, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48010418, "client_id": 59883, "user_id": 108493, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48012170, "client_id": 2913, "user_id": 37412, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48014430, "client_id": 62940, "user_id": 112351, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48022684, "client_id": 63149, "user_id": 113143, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48026886, "client_id": 45391, "user_id": 76047, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48034878, "client_id": 18923, "user_id": 36488, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48042052, "client_id": 63019, "user_id": 113169, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48043326, "client_id": 18923, "user_id": 36488, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48043640, "client_id": 18923, "user_id": 36488, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48051248, "client_id": 15759, "user_id": 92681, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48061250, "client_id": 62007, "user_id": 92681, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48066902, "client_id": 62941, "user_id": 112357, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48081876, "client_id": 51009, "user_id": 87778, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48106514, "client_id": 62236, "user_id": 109579, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48110768, "client_id": 44682, "user_id": 74909, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48114652, "client_id": 39709, "user_id": 67955, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48118216, "client_id": 60459, "user_id": 32532, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48118370, "client_id": 62144, "user_id": 109283, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48118516, "client_id": 60459, "user_id": 32532, "category": "report", "action": "change_mode", "options": {"mode": "deals"}}, {"id": 48118564, "client_id": 60459, "user_id": 32532, "category": "report", "action": "change_mode", "options": {"mode": "summary"}}, {"id": 48118590, "client_id": 60459, "user_id": 32532, "category": "report", "action": "change_mode", "options": {"mode": "deals"}}, {"id": 48118920, "client_id": 60459, "user_id": 32532, "category": "report", "action": "change_mode", "options": {"mode": "summary"}}, {"id": 48120374, "client_id": 60459, "user_id": 32532, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48120386, "client_id": 60459, "user_id": 32532, "category": "report", "action": "change_mode", "options": {"mode": "deals"}}, {"id": 48120602, "client_id": 52492, "user_id": 91178, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48120604, "client_id": 52492, "user_id": 105477, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48120770, "client_id": 60459, "user_id": 32532, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48120876, "client_id": 60459, "user_id": 32532, "category": "table", "action": "sort", "options": {"dir": "ASC", "name": "visitor_id"}}, {"id": 48120896, "client_id": 60459, "user_id": 32532, "category": "table", "action": "sort", "options": {"dir": "DESC", "name": "visitor_id"}}, {"id": 48121006, "client_id": 60459, "user_id": 32532, "category": "table", "action": "sort", "options": {"dir": "ASC", "name": "visitor_id"}}, {"id": 48121008, "client_id": 60459, "user_id": 32532, "category": "table", "action": "sort", "options": {"dir": "DESC", "name": "visitor_id"}}, {"id": 48125372, "client_id": 52492, "user_id": 91178, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48130434, "client_id": 18923, "user_id": 36488, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48135712, "client_id": 25301, "user_id": 54229, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48136376, "client_id": 18923, "user_id": 36488, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48136890, "client_id": 33645, "user_id": 61378, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48145332, "client_id": 62089, "user_id": 109095, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48155244, "client_id": 26705, "user_id": 48880, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48160942, "client_id": 1103, "user_id": 109501, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48166190, "client_id": 62439, "user_id": 110397, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48167428, "client_id": 44196, "user_id": 74136, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 48171114, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48173426, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48173444, "client_id": 62602, "user_id": 111069, "category": "report", "action": "link_click", "options": {"url": "javascript:void(0);", "name": "deal_count", "value": "1"}}, {"id": 48173446, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48173640, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48173686, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48173698, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48174302, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48174312, "client_id": 62602, "user_id": 111069, "category": "report", "action": "link_click", "options": {"url": "javascript:void(0);", "name": "deal_count", "value": "1"}}, {"id": 48174314, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48174338, "client_id": 62602, "user_id": 111069, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 48179988, "client_id": 50149, "user_id": 86073, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57301281, "client_id": 57009, "user_id": 107244, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57326589, "client_id": 57207, "user_id": 107968, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57328781, "client_id": 32792, "user_id": 57997, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57335607, "client_id": 27323, "user_id": 92681, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57355249, "client_id": 24500, "user_id": 45371, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57357969, "client_id": 24500, "user_id": 45371, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 57364085, "client_id": 58330, "user_id": 122756, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57368897, "client_id": 61245, "user_id": 122796, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57380235, "client_id": 19799, "user_id": 108493, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57397813, "client_id": 56544, "user_id": 105404, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 57397881, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-31 23:59:59", "startDate": "2019-03-31 00:00:00"}}, {"id": 57397923, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-30 23:59:59", "startDate": "2019-03-30 00:00:00"}}, {"id": 57397987, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-29 23:59:59", "startDate": "2019-03-29 00:00:00"}}, {"id": 57398079, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-28 23:59:59", "startDate": "2019-03-28 00:00:00"}}, {"id": 57398119, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-27 23:59:59", "startDate": "2019-03-27 00:00:00"}}, {"id": 57398165, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-26 23:59:59", "startDate": "2019-03-26 00:00:00"}}, {"id": 57398203, "client_id": 56544, "user_id": 105404, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-25 23:59:59", "startDate": "2019-03-25 00:00:00"}}, {"id": 57414209, "client_id": 23207, "user_id": 43300, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57414633, "client_id": 23207, "user_id": 43300, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57414663, "client_id": 23207, "user_id": 85282, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57414851, "client_id": 23207, "user_id": 43300, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57420219, "client_id": 48128, "user_id": 121686, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57424709, "client_id": 58113, "user_id": 120952, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 57424757, "client_id": 58113, "user_id": 120952, "category": "report", "action": "change_mode", "options": {"mode": "deals"}}, {"id": 57425399, "client_id": 58113, "user_id": 120952, "category": "table", "action": "sort", "options": {"dir": "ASC", "name": "ac"}}, {"id": 57425421, "client_id": 58113, "user_id": 120952, "category": "table", "action": "sort", "options": {"dir": "DESC", "name": "ac"}}, {"id": 57426007, "client_id": 58113, "user_id": 120952, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-24 23:59:59", "startDate": "2019-03-18 00:00:00"}}, {"id": 57426303, "client_id": 58113, "user_id": 120952, "category": "datepicker", "action": "apply", "options": {"endDate": "2019-03-17 23:59:59", "startDate": "2019-03-11 00:00:00"}}, {"id": 57431787, "client_id": 58113, "user_id": 120952, "category": "page", "action": "enter", "options": {"name": "page"}}, {"id": 57444593, "client_id": 57613, "user_id": 110958, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57453741, "client_id": 61244, "user_id": 120170, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57467371, "client_id": 53666, "user_id": 122224, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57473917, "client_id": 53018, "user_id": 92402, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57475785, "client_id": 53666, "user_id": 122224, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57492477, "client_id": 41737, "user_id": 122874, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57493427, "client_id": 61078, "user_id": 119662, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57515935, "client_id": 20820, "user_id": 116898, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57517657, "client_id": 41737, "user_id": 122874, "category": "page", "action": "enter", "options": {"name": "landing"}}, {"id": 57540495, "client_id": 49700, "user_id": 84946, "category": "page", "action": "enter", "options": {"name": "landing"}}]} \ No newline at end of file diff --git a/hub/main.py b/hub/main.py index 7df869a..71eb3d0 100644 --- a/hub/main.py +++ b/hub/main.py @@ -1 +1,16 @@ -print("Hello, World!") +class restaurant(): + def __init__(self, restaurant_name, cuisine_type): + self.restaurant_name = restaurant_name + self.cuisine_type = cuisine_type + + def describe_restaurant(self): + print(f'{self.restaurant_name.title()}, {self.cuisine_type.title()}') + + def open_rest(self): + print(f'Ресторан {self.restaurant_name.title()} открыт!') + +rest = restaurant('Mish', 'rus') + +rest.describe_restaurant() + +rest.open_rest() diff --git a/litrechure/grokaem/main.py b/litrechure/grokaem/main.py new file mode 100644 index 0000000..e69de29