Which of the following if statements uses a Boolean condition to test: "If the item is on sale, you can buy it"?

A: if( onSale <= "yes" ):
B: if( onSale >= "yes" ):
C: if( onSale == "yes" ):
D: if( onSale != "yes" ):

Respuesta :

Henlo!

Answer:

Of your options given, I would say the best answer is C.) if(onSale == "yes"):.

Why is this correct?

I believe this answer to be true due to what the question is asking. There is no inequality of the variable onSale and "yes", so that throws out A and B. With D; it's testing the reverse of the condition. This means that it's testing if the item is NOT on sale.


I hope this helps!

kkb97
C because the two equals stand for yes