Dec-03-2021, 06:46 PM
Hello, I can't check if this string "operation = str(lst[1])" is equal to a mathematical symbol and that the check is carried out indefinitely:
def solution(): print("Enter an equation") calc = input() lst = calc.split(' ') global x global y global operation while True: try: operation = str(lst[1]) x = float(lst[0]) y = float(lst[2]) except ValueError: print("Do you even know what numbers are? Stay focused!") print("Enter an equation") calc = input() if operation == '+' or operation == '-' or operation == '*' or operation == '/': print(calc) break else: print("Yes ... an interesting math operation.You've slept through all classes, haven't you?") print("Enter an equation") calc = input() solution()