+ 1

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......

26th Jun 2018, 2:47 AM
Atchuthan Gopinathan
Atchuthan Gopinathan - avatar
2 Respuestas
+ 7
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
26th Jun 2018, 3:01 AM
Pao
Pao - avatar
+ 1
thanks dude
26th Jun 2018, 3:27 AM
Atchuthan Gopinathan
Atchuthan Gopinathan - avatar