mercredi 9 décembre 2020

Unable to exit if and else statement in python

I am trying to build a simple spam filter which triggers for given set of words...

user = "Netflix cheap cracked account available. Escrow accepted."

blacklist= ["cheap", "buy", "escrow", "sale"]
a = re.split('\s+', user)
for i in blacklist:
   for j in a:
   
      d = i.upper()
      e = j.upper()
      if d ==e:
        print("spam")
        break
      else:
        print("clean")
        break```


This is my code. I tried to exit if and elif with break and exit(). Both are not working... Please help me.

Aucun commentaire:

Enregistrer un commentaire