+ 7

Why the output of print(True + False) is 1?

19th Jul 2020, 6:29 AM
Nalayak_
Nalayak_ - avatar
19 Answers
+ 6
Here ,in python true means 1 or false means 0 so when we add both value will be 1
19th Jul 2020, 6:33 AM
Sâñtôsh
Sâñtôsh - avatar
19th Jul 2020, 6:43 AM
Alexander Koval🇧🇾
Alexander Koval🇧🇾 - avatar
+ 4
True refers to =1 false refers to=0 so according to your question(true+false)=(1+0)=1
19th Jul 2020, 10:07 AM
Sunil Kumar Sahu
Sunil Kumar Sahu - avatar
+ 3
Never cease of exploration! Sololearn sandbox will give you the answer.
19th Jul 2020, 6:50 AM
Alexander Koval🇧🇾
Alexander Koval🇧🇾 - avatar
+ 3
Their common meaning 1 = True, white, On 0 = False, black, off In this case 1 + 0 = 1
19th Jul 2020, 11:20 AM
Ahmad Sha. Habibi
Ahmad Sha. Habibi - avatar
+ 2
Yes that's very true sis cause Boolean can only hold true or false which is 1 and 0 according to my understanding 😁hope it helps correct if I am wrong that's what your hear for so remove the dislike 😁
19th Jul 2020, 6:51 PM
Pjc
Pjc - avatar
+ 1
Is there any print(True - False) exist?
19th Jul 2020, 6:36 AM
Nalayak_
Nalayak_ - avatar
+ 1
Same discussion topic yesterday (not as much in detail as this one) https://www.sololearn.com/Discuss/2399301/?ref=app
19th Jul 2020, 8:06 AM
Ipang
+ 1
In programming languages value of True is considered as 1. whereas false is zero.therefore In Boolean algebra True + False=1+0=1.
19th Jul 2020, 4:38 PM
Celestine Joy
Celestine Joy - avatar
+ 1
Well it's 1 because False is 0 as an integer and True is 1 as an integer. So 1+0=1
20th Jul 2020, 6:50 AM
SB5K
SB5K - avatar
+ 1
Print(int(True))==>1 Print(int(False))==>0 If you treat True and False for int operations python converts them to integer form
20th Jul 2020, 4:57 PM
Dx bros
Dx bros - avatar
0
It doesn't exist, sorry bro it exists. that's mentioned in Alexander Koval🇧🇾
19th Jul 2020, 6:39 AM
Sâñtôsh
Sâñtôsh - avatar
19th Jul 2020, 6:45 AM
Nalayak_
Nalayak_ - avatar
0
What to learn?? Which one is easy?? Java or Javascript
20th Jul 2020, 4:17 AM
Samarth Gupta
Samarth Gupta - avatar
0
True value is 1 and false value is 0 .1+0 =1
20th Jul 2020, 11:48 AM
Solomon Simeon
Solomon Simeon - avatar