About 1,570,000 results
Open links in new tab
  1. Python | Boolean List AND and OR operations - GeeksforGeeks

    Apr 17, 2023 · Time Complexity: O (n), where n is the length of the list test_list Auxiliary Space: O (1) constant additional space needed Method #3: Using reduce () and operator.and_ or operator.or_ …

  2. How to apply a logical operator to all elements in a python list

    I have a list of booleans in python. I want to AND (or OR or NOT) them and get the result. The following code works but is not very pythonic.

  3. Python Operators - GeeksforGeeks

    Mar 25, 2026 · Types of Operators in Python Operators in Python Arithmetic Operators Arithmetic operators are used to perform basic mathematical operations like addition, subtraction, multiplication …

  4. Python Operators (With Examples) - Programiz

    In this tutorial, we'll learn everything about different types of operators in Python, their syntax and how to use them with examples.

  5. Python Logical Operators - GeeksforGeeks

    Feb 23, 2026 · Python logical operators are used to combine or modify conditions and return a Boolean result (True or False). They are commonly used in conditional statements to control the flow of a …

  6. python - What is the most 'pythonic' way to logically combine a list of ...

    I have a list of booleans I'd like to logically combine using and/or. The expanded operations would be: vals = [True, False, True, True, True, False] # And-ing them together result = True for it...

  7. Boolean Operators in Python (and, or, not) | note.nkmk.me

    Feb 7, 2024 · Boolean operators with non- bool objects Boolean operators and, or, not can evaluate non- bool objects, such as numbers, strings, and lists, as truth values. Built-in Types - Truth Value …

  8. Boolean list initialization - Python - GeeksforGeeks

    Jul 11, 2025 · Let's explore several ways to initialize a boolean list in Python. Using List Multiplication The most efficient way to initialize a boolean list with identical values is by using list multiplication. …

  9. 6. Expressions — Python 3.14.4 documentation

    1 day ago · 6.2.6. List displays ¶ A list display is a possibly empty series of expressions enclosed in square brackets: list_display: "[" [flexible_expression_list | comprehension] "]" A list display yields a …

  10. python - What do boolean operations on lists mean? - Stack Overflow

    Sep 13, 2013 · All objects in Python have a boolean 'value'; they are either true or false in a boolean context. Empty lists are false. This applies to all sequences and containers, including tuples, sets, …