Python True Keyword Last Updated : 06 Mar, 2025 Comments Improve Suggest changes Like Article Like Report True is a built-in Boolean value that represents truth or logical true value. It is one of the two Boolean constants (True and False) and is often used in conditions, loops and logical operations.Python treats True as 1 when used in arithmetic operations and as a truthy value in conditional statements (if-else). Let's take an example. Python if True: print("This will always execute") The print statement will always get executed here because the condition is set to True.Let's look at some examples that involve using True keyword.Example 1: Using True in Conditional Statements Python x = 10 f = x > 5 if f: print("x is greater than 5") Outputx is greater than 5 Explanation: x>5 evaluates as True, hence print statement in if condition gets executed.Example 2: Using True in Loops.True keyword is often used with while loop to create infinite loop. Python c = 0 while True: print(c) c += 1 if c == 5: break # Stops the loop when count reaches 5 Output0 1 2 3 4 Example 3: Using True as 1 in Arithmetic Operations. Python print(True + 5) print(True * 3) Output6 3 Explanation: Python considers True equal to 1 in arithmetc calculations, therefore True + 5 and True + 3 equals 6 and 4 respectively. Comment More infoAdvertise with us Next Article Python True Keyword P prajjqv52 Follow Improve Article Tags : Python python-basics Practice Tags : python Similar Reads Python Keywords Keywords in Python are reserved words that have special meanings and serve specific purposes in the language syntax. Python keywords cannot be used as the names of variables, functions, and classes or any other identifier. Getting List of all Python keywordsWe can also get all the keyword names usin 2 min read Python in Keyword The in keyword in Python is a powerful operator used for membership testing and iteration. It helps determine whether an element exists within a given sequence, such as a list, tuple, string, set or dictionary.Example:Pythons = "Geeks for geeks" if "for" in s: print("found") else: print("not found") 3 min read as Keyword - Python as keyword in Python plays a important role in simplifying code, making it more readable and avoiding potential naming conflicts. It is mainly used to create aliases for modules, exceptions and file operations. This powerful feature reduces verbosity, helps in naming clarity and can be essential whe 3 min read Python def Keyword Python def keyword is used to define a function, it is placed before a function name that is provided by the user to create a user-defined function. In Python, a function is a logical unit of code containing a sequence of statements indented under a name given using the âdefâ keyword. In Python def 6 min read Python del keyword The del keyword in Python is used to delete objects like variables, lists, dictionary entries, or slices of a list. Since everything in Python is an object, del helps remove references to these objects and can free up memorydel Keyword removes the reference to an object. If that object has no other 2 min read Like