dimanche 13 janvier 2019

isalpha() and logical operator not is showing invalid syntax error

A simple program in python3

def simple(code):
   if not (len(code)===3) and code.isalpha()):
     raise valueError("Incorrect code {}".format(code))

here code is string like "YML". I am getting an invalid syntax error at if loop. Any suggestion of what is the mistake would be helpful.... thanks in advance

Aucun commentaire:

Enregistrer un commentaire