- 1
Can the Boolean values, True and False, be represented by 1 and 0 respectively?
3 odpowiedzi
+ 1
In general, any value except null/nil/0 will be considered to be 'True', while 0/... will mean 'False'.
+ 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...
- 1
depends on what you're setting the output for each case..