About 7,820,000 results
Open links in new tab
  1. How do I use a Boolean in Python? - Stack Overflow

    Does Python actually contain a Boolean value? I know that you can do: checker = 1 if checker: #dostuff But I'm quite pedantic and enjoy seeing booleans in Java. For instance: Boolean …

  2. How to use boolean 'and' in Python - Stack Overflow

    Dec 8, 2013 · How to use boolean 'and' in Python [duplicate] Asked 16 years, 9 months ago Modified 12 years ago Viewed 286k times

  3. What is Python's equivalent of && (logical-and) in an if-statement?

    Sep 13, 2023 · There is no bitwise negation in Python (just the bitwise inverse operator ~ - but that is not equivalent to not). See also 6.6. Unary arithmetic and bitwise/binary operations and …

  4. Syntax for an If statement using a boolean - Stack Overflow

    I just recently joined the python3 HypeTrain. However I just wondered how you can use an if statement onto a boolean. Example: RandomBool = True # and now how can I check this in …

  5. Converting from a string to boolean in Python - Stack Overflow

    How do I convert a string into a boolean in Python? This attempt returns True: >>> bool ("False") True

  6. boolean - 'True' and 'False' in Python - Stack Overflow

    Boolean operations: In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: False, None, numeric …

  7. python - Parsing boolean values with argparse - Stack Overflow

    I would like to use argparse to parse boolean command-line arguments written as "--foo True" or "--foo False". For example: my_program --my_boolean_flag False However, the following test …

  8. python - Logical operators for Boolean indexing in Pandas - Stack …

    Python's and, or and not logical operators are designed to work with scalars. So Pandas had to do one better and override the bitwise operators to achieve a vectorized (element-wise) version of …

  9. python - What is the correct way to check for False? - Stack Overflow

    I would write if not somevalue: although for non boolean types it will behave differently: if not "": will run the code but if "" == False: will not.

  10. Get a random boolean in python? - Stack Overflow

    Jul 26, 2011 · I am looking for the best way (fast and elegant) to get a random boolean in python (flip a coin). For the moment I am using random.randint(0, 1) or random.getrandbits(1).