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 PMAmaklia Ilkama
2 AnswersNew Answer
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)