├── LICENSE ├── README.md ├── arrangement of lessons.py └── html & css /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Dimitar Dimitrov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SoftUni-Fundamentals-page 2 | This is a try to make a basic copy of the SoftUni Python Fundamentals page https://softuni.bg/trainings/3840/programming-fundamentals-with-python-september-2022 3 | -------------------------------------------------------------------------------- /arrangement of lessons.py: -------------------------------------------------------------------------------- 1 | def add(course: list, title: str): 2 | if title not in course: 3 | course.append(title) 4 | 5 | 6 | def insert(course: list, title: str, index: int): 7 | if title not in course: 8 | course.insert(index, title) 9 | 10 | 11 | def remove(course: list, title: str): 12 | if title in course: 13 | if f"{title}-Exercise" in course: 14 | course.remove(f"{title}-Exercise") 15 | course.remove(title) 16 | 17 | 18 | def swap(course: list, first_title: str, second_title: str): 19 | if first_title in course and second_title in course: 20 | first_course_index = course.index(first_title) 21 | second_course_index = course.index(second_title) 22 | course[first_course_index], course[second_course_index] = course_list[second_course_index], course_list[first_course_index] 23 | index = course.index(second_title) + 1 24 | if index < len(course): 25 | if course[index] == f"{first_title}-Exercise": 26 | course.pop(index) 27 | index = course.index(first_title) + 1 28 | course.insert(index, f"{first_title}-Exercise") 29 | index = course.index(first_title) + 1 30 | if index < len(course): 31 | if course[index] == f"{second_title}-Exercise": 32 | course.pop(index) 33 | index = course.index(second_title) + 1 34 | course.insert(index, f"{second_title}-Exercise") 35 | 36 | 37 | def exercise(course: list, title: str): 38 | if title in course and f"{title}-Exercise" not in course: 39 | index = course.index(title) 40 | course.insert(index + 1, f"{title}-Exercise") 41 | elif title not in course: 42 | course.append(title) 43 | course.append(f"{title}-Exercise") 44 | 45 | 46 | course_list = input().split(', ') 47 | 48 | while True: 49 | command = input().split(':') 50 | 51 | if command[0] == "course start": 52 | break 53 | 54 | lesson_title = command[1] 55 | 56 | if command[0] == 'Add': 57 | add(course_list, lesson_title) 58 | 59 | elif command[0] == "Insert": 60 | current_index = int(command[-1]) 61 | insert(course_list, lesson_title, current_index) 62 | 63 | elif command[0] == "Remove": 64 | remove(course_list, lesson_title) 65 | 66 | elif command[0] == "Swap": 67 | second_lesson_title = command[-1] 68 | swap(course_list, lesson_title, second_lesson_title) 69 | 70 | elif command[0] == "Exercise": 71 | exercise(course_list, lesson_title) 72 | 73 | for curr_index, lesson_name in enumerate(course_list): 74 | print(f"{curr_index + 1}.{lesson_name}") 75 | -------------------------------------------------------------------------------- /html & css: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | --------------------------------------------------------------------------------