From d0c8a9d575c95d9efc30cec55714887c2a269d6e Mon Sep 17 00:00:00 2001 From: SosninaV Date: Sun, 23 Nov 2025 17:44:57 +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"calk"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calculator.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 calculator.py diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..36c24bc --- /dev/null +++ b/calculator.py @@ -0,0 +1,25 @@ +while True: + print("\n1 - сложение") + print("2 - умножение") + print("0 - выход") + + choice = input("Ваш выбор: ") + + if choice == "0": + print("Выход.") + break + + numbers = list(map(float, input("Введите числа через пробел: ").split())) + + if choice == "1": + print("Результат:", sum(numbers)) + + elif choice == "2": + result = 1 + for n in numbers: + result *= n + print("Результат:", result) + + else: + print("Нет такого действия.") + \ No newline at end of file