Can the Boolean values, True and False, be represented by 1 and 0 respectively? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Can the Boolean values, True and False, be represented by 1 and 0 respectively?

25th Jan 2016, 10:46 AM
Kostas Lifeboy
Kostas Lifeboy - avatar
3 Answers
+ 1
In general, any value except null/nil/0 will be considered to be 'True', while 0/... will mean 'False'.
5th Mar 2016, 8:21 AM
Martin Wild
Martin Wild - avatar
+ 1
YES they can when boolean values are represented in numbers True=1 False=0 (however any non-zero value would be True when converted to boolean using bool() ) in python , True + True =2 True*True =1 True*2 =2 True/5 =0.2 False+True+2=3 and so on...
11th Oct 2016, 2:02 PM
Sunera
Sunera - avatar
- 1
depends on what you're setting the output for each case..
23rd Jul 2016, 4:26 AM
uzair