KnowledgeBoat Logo

Computer Science

Evaluate and Justify:

(i) false and None

(ii) 0 and None

(iii) True and None

(iv) None and None

Python Data Handling

25 Likes

Answer

(i) This produces an error as false is an invalid literal in Python. It should be False. Had the expression being False and None, the return value will be False.

(ii) This logical expression evaluates to 0. As first operand of and operator is false so it will return the first operand itself.

(iii) This logical expression evaluates to None. As first operand of and operator is True so it will return the second operand.

(iv) This logical expression evaluates to None. As first operand of and operator is false so it will return the first operand itself.

Answered By

13 Likes


Related Questions