JustCaptain kod-buduschego
53f23cfd3cd1680139f6a3e77997f1cb3a9b19b3
Перейти к файлу
Код
code.py
def add(a: float, b: float) -> float:
    result: float = a + b
    return result


result_one = add(a=15.0, b=30.0)
print("РЕЗУЛЬТАТ ОНЕ: ", result_one)


def is_even(n: int) -> bool:
    if n % 2 == 0:
        return True
    return False


result_two = is_even(n=16)
print("ЧИСЛО ЧЕТНОЕ: {}".format(result_two))


def min_max(numbers: list[int]) -> tuple:
    min_numbers = min(numbers)
    max_number = max(numbers)
    return min_numbers, max_number


result_three = min_max(numbers=[1, 2, 3, 4, 5, 6, 7, 15, 25325, 34, 5, -15])
print("МИНИМАЛЬНОЕ И МАКСИМАЛЬНОЕ ЗНАЧЕНИЕ: {}".format(result_three))


def check_password(password: str) -> str:
    if len(password) < 6:
        return "Слишком короткий"
    return "Подходит"


result_four = check_password("qwert")
print(result_four)


def rectangle_area(width: int, height: int) -> int:
    return width * height


result_five = rectangle_area(15, 15)
print(f"ПЛОЩАДЬ: {result_five}")


def save_divide(a: int, b: int) -> float | str:
    if b == 0:
        return "Ошибка деление на ноль"
    return a / b


result_six_a = save_divide(a=15, b=0)
result_six_b = save_divide(a=15, b=5)
print(f"Деление A: {result_six_a}")
print(f"Деление B: {result_six_b}")