diff --git a/guess.py b/guess.py new file mode 100644 index 0000000..26812ad --- /dev/null +++ b/guess.py @@ -0,0 +1,33 @@ +import itertools + +def all_combinations(alphabet, max_length): + """Генерирует все комбинации длиной от 1 до max_length""" + all_combos = [] + for length in range(1, max_length + 1): + combos = itertools.product(alphabet, repeat=length) + all_combos.extend([''.join(combo) for combo in combos]) + return all_combos + +russian_lower = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя' +def vectorize(word, combinations): + vector = [] + if len(word) == 1: + return None + last = None + for curr in word: + if not last: + last = curr + continue + pair = last + curr + indx = combinations.index(pair) + vector.append(indx) + return vector + + +word = 'маме' +combinations = all_combinations(russian_lower, 2) +result = vectorize(word, combinations) + +print("Все комбинации длиной 1-2:") +print(combinations) +print("Вектор:", result) diff --git a/lesson_2/home_task/color.jpg b/lesson_2/home_task/color.jpg new file mode 100644 index 0000000..5091fc3 Binary files /dev/null and b/lesson_2/home_task/color.jpg differ diff --git a/lesson_3/manual/lection_3.pdf b/lesson_3/manual/lection_3.pdf new file mode 100644 index 0000000..bcfd03c Binary files /dev/null and b/lesson_3/manual/lection_3.pdf differ diff --git a/lesson_4/manual/collection.pdf b/lesson_4/manual/collection.pdf new file mode 100644 index 0000000..99d4c6a Binary files /dev/null and b/lesson_4/manual/collection.pdf differ