KnowledgeBoat Logo

Computer Science

Evaluate and Justify:

(a) 0 or None and "or"

(b) 1 or None and 'a' or 'b'

(c) False and 23

(d) 23 and False

(e) not (1 == 1 and 0 != 1)

(f) "abc" == "Abc" and not (2 == 3 or 3 == 4)

(g) False and 1 == 1 or not True or 1 == 1 and False or 0 == 0

Python Data Handling

38 Likes

Answer

(a) 0 or None and "or"
 ⇒ 0 or None   [∵ and has higher precedence than or]
 ⇒ None

(b) 1 or None and 'a' or 'b'
 ⇒ 1 or None or 'b'
 ⇒ 1 or 'b'
 ⇒ 1

(c) False and 23
 ⇒ False

(d) 23 and False
 ⇒ False

(e) not (1 == 1 and 0 != 1)
 ⇒ not (True and True)
 ⇒ not True
 ⇒ False

(f) "abc" == "Abc" and not (2 == 3 or 3 == 4)
 ⇒ "abc" == "Abc" and not (False or False)
 ⇒ "abc" == "Abc" and not False
 ⇒ False and not False
 ⇒ False and True
 ⇒ False

(g) False and 1 == 1 or not True or 1 == 1 and False or 0 == 0
 ⇒ False and True or not True or True and False or True
 ⇒ False and True or False or True and False or True
 ⇒ False or False or False or True
 ⇒ False or False or True
 ⇒ False or True
 ⇒ True

Answered By

21 Likes


Related Questions