About 396,000 results
Open links in new tab
  1. Python Booleans - W3Schools

    Booleans represent one of two values: True or False. In programming you often need to know if an expression is True or False. You can evaluate any expression in Python, and get one of two answers, True or False. When you compare two values, the expression is evaluated and Python returns the Boolean answer:

  2. bool() in Python - GeeksforGeeks

    Feb 21, 2025 · In Python, bool() is a built-in function that is used to convert a value to a Boolean (i.e., True or False). The Boolean data type represents truth values and is a fundamental concept in programming, often used in conditional statements, loops and logical operations.

  3. Python Booleans: Use Truth Values in Your Code – Real Python

    In this tutorial, you'll learn about the built-in Python Boolean data type, which is used to represent the truth value of an expression. You'll see how to use Booleans to compare values, check for identity and membership, and control the flow of your programs with conditionals.

  4. Booleans in Python

    Learn about Python booleans, their declaration, boolean values of data types using bool() function & operations that give boolean values.

  5. Python Boolean - GeeksforGeeks

    Dec 5, 2024 · We can evaluate values and variables using the Python bool() function. This method is used to return or convert a value to a Boolean value i.e., True or False, using the standard truth testing procedure.

  6. How do I use a Boolean in Python? - Stack Overflow

    Mar 16, 2018 · Python booleans are not integers; 1 is not True, but 1 == True. @BallpointBen: they are integers in the common sense of being instances of the int type, as shown by isinstance(True, int). The boolean builtins are capitalized: True and False.

  7. Python bool() (With Examples) - Programiz

    The bool() method takes a specified argument and returns its boolean value. The syntax of bool() is: The bool() method takes in a single parameter: The bool() method returns: Output. In the above example, we have used the bool() method with various arguments like integer, floating point numbers, and string.

  8. Python Booleans: A Complete Guide with Examples

    Dec 10, 2024 · Boolean Functions. Python provides built-in functions to work with Booleans. 1. bool() Function: The bool() function converts a value into its Boolean equivalent. print(bool(0)) # Output: False print(bool(1)) # Output: True print(bool([])) # Output: False print(bool("Hello"))# Output: True 2. isinstance() Function:

  9. Python Boolean and Conditional Programming: if.. else

    Jun 8, 2022 · In Python, we use booleans in combination with conditional statements to control the flow of a program: ... print("Mum, open the door!") Mum, open the door! >>> door_is_locked = True >>> if door_is_locked: ... print ("Mum, open the door!") ... Mum, open the door! >>>_ Here’s an interactive version of the same code that you can experiment with:

  10. The Ultimate Boolean in Python Tutorial - Simplilearn

    Oct 9, 2024 · If you want to define a boolean in Python, you can simply assign a True or False value or even an expression that ultimately evaluates to one of these values. You can check the type of the variable by using the built-in type function in Python. Note that the type function is built-in in Python and you don’t have to import it separately.

  11. Some results have been removed
Refresh