Boolean theory | Sololearn: Learn to code for FREE!

+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?

11/18/2020 4:53:04 PM

Amaklia Ilkama

2 Answers

New Answer

+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)

+2

Thank you