[Solved] Calculator, using python, 0 used 1st, it never recognizes the second input to calculate.


A better approach is to use a while loop to collect input, and only exit the while loop after receiving valid data.

num1 = 0
while num1 == 0:
    value = input(....
    if ValidateInput(value):
        num1 = value
num2 = 0
while num2 == 0:
    value = input(....
    if ValidateInput(value):
        num2 = value
# do other stuff

def ValidateInput(input):
    """Common code that ensures the input is a numerical value, etc"""

solved Calculator, using python, 0 used 1st, it never recognizes the second input to calculate.