commit d288c528d3562badd0c4929ad71076d58fe4aa4b Author: LyalinaA Date: Mon Nov 24 08:03:35 2025 +0000 Загрузить файлы в «/» diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..93867df --- /dev/null +++ b/calculator.py @@ -0,0 +1,23 @@ +def calculator(): + print("Выберите операцию:") + print("1. Сложение") + print("2. Умножение") + + choice = input("Введите номер операции (1/2): ") + + if choice in ['1', '2']: + num1 = float(input("Введите первое число: ")) + num2 = float(input("Введите второе число: ")) + + if choice == '1': + result = num1 + num2 + operation = "Сложение" + else: + result = num1 * num2 + operation = "Умножение" + + print(f"Результат {operation}: {result}") + else: + print("Некорректный ввод.") + +calculator()