+ 3
Basic Python Question
Guys why that code series turn 4 at terminal? Because one of them is integer and the other one is boolean. So it has to give error because we can't do process with different data types. I am really confused. x= 3 y= True print(x+y)
2 Answers
+ 8
Pariket Thakur ,
sorry to say, but your answer is not complete correct.
True == 1
False == 0 # <<<
so the addition of x (3) + y (True) is the same as: 3 + 1
+ 3
Lothar
Oops ! I am extremely sorry for this
actually I was trying to type fast
True == 1
False == 0