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
  • 8,084
  • 8
  • 48
  • 62
Victor
  • 16,609
  • 71
  • 229
  • 409
  • 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