while True:
print("\nКАЛЬКУЛЯТОР")
print("+ - Сложение")
print("- - Вычитание")
print("* - Умножение")
print("/ - Деление")
print("** - Степень")
print("% - Процент от числа")
print("√ - Квадратный корень")
print("q - Выход")
s = input("Выберите действие: ")
if s == "q":
break
if s not in ("+", "-", "*", "/", "**", "%", "√"):
print("Неверное действие!")
continue
x = float(input("Первое число: "))
if s == "√":
if x >= 0:
print("Ответ:", x ** 0.5)
else:
print("Ошибка! Отрицательное число")
continue
y = float(input("Второе число: "))
if s == "+":
print("Ответ:", x + y)
elif s == "-":
print("Ответ:", x - y)
elif s == "*":
print("Ответ:", x * y)
elif s == "/":
if y != 0:
print("Ответ:", x / y)
else:
print("На ноль делить нельзя!")
elif s == "**":
print("Ответ:", x ** y)
elif s == "%":
print("Ответ:", x * y / 100)