0 votes
36 views
in Python by (47 points)
What is the output of bool(5)?

a)0

b)Valid

c)1

d)False

e)True

1 Answer

0 votes
by (1.5k points)
Answer is True

The bool() returns:

False if the value is omitted or false

True if the value is true

The following values are considered false in Python:

None

False

Zero of any numeric type. For example, 0, 0.0, 0j

Empty sequence. For example, (), [], ''.

Empty mapping. For example, {}

objects of Classes which has __bool__() or __len()__ method which returns 0 or False

All other values except these values are considered true.

Related questions

0 votes
1 answer
776 views
asked May 17 in Python by Derya (47 points)
0 votes
0 answers
35 views
0 votes
1 answer
24 views
0 votes
2 answers
40 views
0 votes
1 answer
28 views
0 votes
1 answer
24 views
0 votes
1 answer
24 views
0 votes
1 answer
22 views
0 votes
2 answers
25 views
0 votes
0 answers
16 views
...