0
votes

I am trying to write code in which the program asks the user to enter 2 number and an operator. I am not done with it, but, when I run to see what's happening so far I get an error saying: SyntaxError: unexpected EOF while parsing, line 21. What does it mean and how can I solve it?

while num:
    if  num.isnumeric():
        num = int(num)
        nums = (input('Enter second number: '))
        break

    else:
        print('Error. Please enter a valid number')
        num = input('Enter first number: ')

while nums:
    if nums.isnumeric():
        nums = int(nums)
        operator = input('Enter operator (x,/,+,-): ')

        break

    else:
        print('Error. Please enter a valid number')
        nums = (input('Enter second number: ')
                ```
1

1 Answers

1
votes

You are missing one ")" at the end of your last input declaration.

else:
    print('Error. Please enter a valid number')
    nums = (input('Enter second number: '))