0

I am trying to test a boolean AND condition like below:

def test(a,b):
    if(a=='cust' & b=='id'):
        print 0
    else:
        print 1

test('cust','id')

I get:

unsupported operand type(s) for &: 'str' and 'str'
Vadim Kotov
  • 7,766
  • 8
  • 46
  • 61
Victor
  • 15,903
  • 67
  • 211
  • 390
  • 1
    For scalar need `and` like `if(a=='cust' and b=='id')` – jezrael Jul 11 '18 at 15:10
  • 1
    .. because in Python `&` is *exclusively* the [bitwise operator](https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations). – Jongware Jul 11 '18 at 15:18

0 Answers0