From ddd958b53858300930605a736085c2dc3f3b7b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=A7=D0=B5=D1=80=D0=BD=D1=8F=D1=82=D1=8C=D0=B5=D0=B2?= Date: Sat, 4 Apr 2026 09:44:22 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20results/top=5Ftracks.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- results/top_tracks.txt | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/results/top_tracks.txt b/results/top_tracks.txt index 0278bc5..007cc52 100644 --- a/results/top_tracks.txt +++ b/results/top_tracks.txt @@ -36,6 +36,65 @@ if __name__ == "__main__": main() ============================= +# №7. Дешифровка Цезаря +def decode_caesar(text: str, shift: int) -> str: + res = "" + for c in text: + new = ord(c) - shift + if new < 1072: + new = new + 32 + res = res + chr(new) + return res + +# №8. НОД (алгоритм Евклида) +def gcd(a: int, b: int) -> int: + while b != 0: + temp = b + b = a % b + a = temp + return a + +# №3. Проверка пароля +def is_strong_password(password: str) -> bool: + if len(password) < 8: + return False + + has_digit = False + has_upper = False + + for c in password: + if c >= "0" and c <= "9": + has_digit = True + if c >= "A" and c <= "Z": + has_upper = True + + return has_digit and has_upper + +# №16. Удаление выбросов +def remove_outliers(numbers: list, threshold: float) -> list: + if len(numbers) == 0: + return [] + + # Считаем среднее + summa = 0 + for x in numbers: + summa = summa + x + mean = summa / len(numbers) + + # Считаем стандартное отклонение + sum_sq = 0 + for x in numbers: + sum_sq = sum_sq + (x - mean) ** 2 + std = (sum_sq / len(numbers)) ** 0.5 + + # Собираем результат + res = [] + for x in numbers: + if (x - mean) <= threshold * std and (mean - x) <= threshold * std: + res.append(x) + return res + + # 1. is_armstrong(n: int) -> bool # Проверяет, является ли число числом Армстронга. # Идея: переводим число в строку, считаем количество цифр,