Boolean theory | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Boolean theory

Hi👋 Can anyone tells me about what is boolean theory . For example in python we have True function and False function . How does boolean works and how does true and false works in programming languages like python ? And How can I use true and false in programs?

18th Nov 2020, 4:53 PM
Amaklia Ilkama
Amaklia Ilkama - avatar
2 Answers
+ 6
False is 0 True is 1 (True can be any value other than 0 though) an example would be the infinite loop: while True: print("Hello") # same as while 1: print("Hello") We can use this to continuously loop through a set of commands and you can potentially have a check, and if that check succeeds, it could make it False and the loop stops. running = True while running: word = input("Type a word (or 'q' to quit): ") if word == 'q': running = False break print("You typed:",word)
18th Nov 2020, 5:03 PM
Slick
Slick - avatar
+ 2
Thank you
18th Nov 2020, 5:14 PM
Amaklia Ilkama
Amaklia Ilkama - avatar