diff --git a/calculator.py b/calculator.py index 36c24bc..750f8ef 100644 --- a/calculator.py +++ b/calculator.py @@ -1,25 +1,14 @@ -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 +num1 = float(input("введите первое число")) +num2 = float(input("введите второе число")) +operator = input("введите знак") +if operator == "+": + result= num1 + num2 +elif operator == "-": + result = num1-num2 +elif operator == "/": + result = num1 / num2 +elif operator == "*": + result = num1 * num2 +else: + print("ошибка ввода") +print(result) \ No newline at end of file