Guest User

Untitled

a guest
Oct 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. '''
  2. Write a function that tells you whether or not a given word follows the "I before E except after C" rule.
  3.  
  4. check("a") => true
  5. check("zombie") => true
  6. check("transceiver") => true
  7. check("veil") => false
  8. check("icier") => false
  9. '''
  10.  
  11. def CheckRule(word):
  12. if 'c' in word:
  13. if 'cie' in word:
  14. return False
  15. elif 'cei' in word:
  16. return True
  17. else:
  18. return True
  19. else:
  20. if 'ei' in word:
  21. return False
  22. elif 'ie' in word:
  23. return True
  24. else:
  25. return True
  26.  
  27. words_to_check = ["a", "zombie", "transceiver", "veil", "icier"]
  28.  
  29. for word in words_to_check:
  30. print(CheckRule(word))
Add Comment
Please, Sign In to add comment