commit 97f8df254ae0ce3af4f9f32286bb9ecbf2c91b3d Author: LyalinaA Date: Thu Nov 27 09:23:34 2025 +0000 Загрузить файлы в «/» diff --git a/dfjhgerg.py b/dfjhgerg.py new file mode 100644 index 0000000..89d4663 --- /dev/null +++ b/dfjhgerg.py @@ -0,0 +1,31 @@ +def calculator(): + print("Выберите операцию:") + print("1. Сложение") + print("2. Умножение") + print("3. Вычитание") + print("4. Деление") + + choice = input("Введите номер операции (1/2/3/4): ") + + if choice in ['1', '2','3','4']: + num1 = float(input("Введите первое число: ")) + num2 = float(input("Введите второе число: ")) + + if choice == '1': + result = num1 + num2 + operation = "Сложение" + if choice == '2': + result = num1 * num2 + operation = "Умножение" + if choice == '3': + result = num1 - num2 + operation = "Вычитание" + if choice == '4': + result = num1 / num2 + operation = "Деление" + + print(f"Результат {operation}: {result}") + else: + print("Некорректный ввод.") + +calculator() \ No newline at end of file