From 24ac880e1a868df2caf9798d5715102cf3c41649 Mon Sep 17 00:00:00 2001 From: ShustovaK Date: Sun, 23 Nov 2025 18:07:21 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B2=20"calculyator?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calculator.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 calculator.py diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..efc3d41 --- /dev/null +++ b/calculator.py @@ -0,0 +1,28 @@ +while True: + print("Выбери действие:") + print("1 - сложение") + print("2 - умножение") + print("0 - выход") + + choice = input("Ваш выбор: ") + + if choice == "0": + print("Выход из программы.") + break + + + numbers = input("Введите числа через пробел: ").split() + numbers = [float(x) for x in numbers] + + if choice == "1": + result = sum(numbers) + print("Результат сложения:", result) + + elif choice == "2": + result = 1 + for num in numbers: + result *= num + print("Результат умножения:", result) + + else: + print("Неизвестная команда!") \ No newline at end of file