Why the output of print(True + False) is 1? | Sololearn: Learn to code for FREE!

+7

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

7/19/2020 6:29:19 AM

Nalayak_

19 Answers

New Answer

+1

Sawan Check it πŸ‘‡ https://code.sololearn.com/cMZI5bvrjexI/?ref=app

+15

Sawan True refers to 1 False refers to 0 So, True + False = 0 + 1 = 1 True + True = 1 + 1 = 2 False + False = 0 + 0 = 0

+6

Here ,in python true means 1 or false means 0 so when we add both value will be 1

+4

Why not? You can try this: https://code.sololearn.com/c2KM3jC9eebG/?ref=app

+4

True refers to =1 false refers to=0 so according to your question(true+false)=(1+0)=1

+3

Never cease of exploration! Sololearn sandbox will give you the answer.

+3

Their common meaning 1 = True, white, On 0 = False, black, off In this case 1 + 0 = 1

+2

Såñtösh Màràvi[Inactive] it exists

+2

Alexander KovalπŸ‡§πŸ‡Ύ πŠπ’π’π›π¨ π†π‘πšπ²πšπ₯ thanks

+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 😁

+1

Is there any print(True - False) exist?

+1

Same discussion topic yesterday (not as much in detail as this one) https://www.sololearn.com/Discuss/2399301/?ref=app

+1

In programming languages value of True is considered as 1. whereas false is zero.therefore In Boolean algebra True + False=1+0=1.

+1

Well it's 1 because False is 0 as an integer and True is 1 as an integer. So 1+0=1

+1

Print(int(True))==>1 Print(int(False))==>0 If you treat True and False for int operations python converts them to integer form

0

It doesn't exist, sorry bro it exists. that's mentioned in Alexander KovalπŸ‡§πŸ‡Ύ

0

πŠπ’π’π›π¨ π†π‘πšπ²πšπ₯ really? plz elaborate

0

What to learn?? Which one is easy?? Java or Javascript

0

True value is 1 and false value is 0 .1+0 =1