Qustion of return of true, variable

I’m trying to return the second variable of my return statement from my function. I dont know if it works but its how our professor would like the statement to execute.

def check(number1, number2, operation, guess):
    if operation == '+':
        answer = number1 + number2
        if answer == guess:
            return True, answer
            return False, answer

How would I come out with the statements.
‘You answered correctly’ , if the statement Returns True
(‘The correct answer is’, answer)<-- the second half of the return statement.
So far what i get when i execute is (True, #) or (False,#) when i execute

print(check(number1, number2, operator, guess))

Hey can you post the whole code if possible?

I think you want to do this:

match, answer = check(1, 2, add, 12)

If you do a return X, Y on the right then you just need to do Z, J = on the left hand side.

1 Like

This worked for me thanks!