Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

Does Python actually contain a Boolean value? I know that you can do:

checker = 1 

if checker: 

#dostuff

But I'm quite pedantic and enjoy seeing booleans in Java. For instance:

Boolean checker; 

if (someDecision) { 

checker = true; 

if(checker) { 

//some stuff 

}

Is there such a thing as a Boolean in Python? I can't seem to find anything like it in the documentation.

1 Answer

0 votes
by (106k points)

You can use the below-mentioned code for the same:-

checker = None # not necessary 

if some_decision: 

checker = True 

if checker: 

# some stuff

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...