commit 24ac880e1a868df2caf9798d5715102cf3c41649 Author: ShustovaK Date: Sun Nov 23 18:07:21 2025 +0000 Загрузить файл в "calculyator" 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