Python’s equivalent of && (logical-and) in an if-statement

and-operatorif statementkeywordlogical-operatorspython

Here's my code:

def front_back(a, b):
  # +++your code here+++
  if len(a) % 2 == 0 && len(b) % 2 == 0:
    return a[:(len(a)/2)] + b[:(len(b)/2)] + a[(len(a)/2):] + b[(len(b)/2):] 
  else:
    #todo! Not yet done. :P
  return

I'm getting an error in the IF conditional.
What am I doing wrong?

Best Answer

You would want and instead of &&.