About 3,280,000 results
Open links in new tab
  1. What is Python's equivalent of && (logical-and) in an if-statement?

    Mar 21, 2010 · Say you want to build Logic Gates in Python: def AND(a,b): return (a and b) #using and operator def OR(a,b): return (a or b) #using or operator Now try calling them: print …

  2. python - How to determine whether a year is a leap year ... - Stack ...

    Jul 24, 2012 · The logic in the "one-liner" works fine. From personal experience, what has helped me is to assign the statements to variables (in their "True" form) and then use logical operators …

  3. 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 …

  4. logic - AND/OR in Python? - Stack Overflow

    Apr 14, 2012 · Python logic mnemonic. 0. Skip over a set of values (in an array) in a loop - Python3-2. Can't solve this ...

  5. Creating a truth table for any expression in Python

    Apr 9, 2015 · You could simply define any boolean function right in python. consider the following example: def f(w,x,y,z): return (x and y) and (w or z) I've wrote a snippet that takes any …

  6. How to check for palindrome using Python logic - Stack Overflow

    Jun 27, 2013 · I'm trying to check for a palindrome with Python. The code I have is very for-loop intensive. And it seems to me the biggest mistake people do when going from C to Python is …

  7. python - How to perform element-wise Boolean operations on …

    Note that you can use ~ for elementwise negation.. arr = np.array([False, True]) ~arr OUTPUT: array([ True, False], dtype=bool)

  8. How to get the logical right binary shift in python

    I think you got the sense of the question backwards. All python shifts are arithmetic. You have implemented an arithmetic shift., duplicating python's functionality The original question is …

  9. Runtime vs Syntax vs Logic Errors for Python - Stack Overflow

    Jul 2, 2020 · Python logic error? 0. Python bugs or errors. 1. Python syntax errors. 0. Python keeps generating syntax ...

  10. How to implement retry mechanism into Python Requests library?

    Method to retry certain logic if some exception has occured at time intervals t1=1 sec, t2=2 sec, t3=4 sec. We can increase/decrease the time interval as well. MAX_RETRY = 3 retries = 0 try: …

Refresh