293,790 views
27 votes
27 votes
What is the output of this program? numA = 2 numB = 3 if numA == 2 or numB == 2: print("yes") elif numA == 2 and numB == 3: print("no") Output:

User Chris Wingler
by
2.5k points

1 Answer

20 votes
20 votes

Answer:

The outcome would be "yes".

Explenation:

numA = 2

numB = 3

if numA == 2 or numB == 2:

print("yes")

elif numA == 2 and numB == 3:

print("no")

numA = 2

This line of code declares the variable numA and gives it a value of 2

numB = 3

This line of code declares the variable numB and gives it a value of 3

if numA == 2 or numB == 2:

This part activate the next line of code only if the statement (numA == 2 or numB == 2) is True

print("yes")

This code prints out "yes" in the terminal.

elif numA == 2 and numB == 3:

This line of code is similar to the ifstatement above. The code below activates only if the statement (numA == 2 and numB == 3) is True and the previous ifstatement wasn't True.

print("no")

This code prints out "no" in the terminal.

User Tehleel Mir
by
3.0k points