>>> False == False or True True >>> False == (False or True) False >>> (False == False) or True True | SoloLearn: Learn to code for FREE!

0

>>> False == False or True True >>> False == (False or True) False >>> (False == False) or True True

could someone please explain this code , thanks

7/9/2019 10:13:50 AM

Ishieta Dhar

1 Answer

New Answer

0

You've propably seen this graph: https://www.sololearn.com/learn/Python/2280/ The innermost parenthese pair is always solved first. In the example, (False or True) and (False == False) are solved first. Then you can check the graph and you can see the comparison operators, such as ==, to have higher operator precedence than logical operators, such as or, this means that == operations are solved before or operations. False == False or True #== is operated first, False == False is True, so let's replace False == False with True: =True or True #Because True or True is True, let's replace it with True: =True False == (False or True) #Because of the parentheses (False or True) is solved first, because False or True is True, let's replace it with True: =False == True #Because False == True is False, let's replace it with False: =False (False == False) or True #Parentheses are not necessary, (False == False) would have been solved first anyways, but False == False is True, so let's replace it with True.No space