JustCaptain kod-buduschego
f1849d7f7b7914524e1324ccc17ef5403a17b1c1
Перейти к файлу
Код
task_4.py
def temp_converter(value: float, from_scale: str, to_scale: str) -> float:
    result: float = 0.0
    if from_scale == "C" and to_scale == "F":
        result = value * 9 / 5 + 32
    elif from_scale == "F" and to_scale == "C":
        result = (value - 32) * 5 / 9
    else:
        result = value
    return result