In booleans ive confused | SoloLearn: Learn to code for FREE!


In booleans ive confused

a=6==3+3 print (a) b=4==4 print (b) c=a+b print (c) output I've got was true true 2 why I've got 2 as my output......

6/26/2018 2:47:05 AM

Atchuthan Gopinathan

2 Answers

New Answer


In Python, the booleans True and False are also equal to: True = 1 and False = 0 When you use the "+" operator for c, Python is implicitly adding the integer values of True for a and b