Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Write a function that tells you whether or not a given word follows the "I before E except after C" rule.
- check("a") => true
- check("zombie") => true
- check("transceiver") => true
- check("veil") => false
- check("icier") => false
- '''
- def CheckRule(word):
- if 'c' in word:
- if 'cie' in word:
- return False
- elif 'cei' in word:
- return True
- else:
- return True
- else:
- if 'ei' in word:
- return False
- elif 'ie' in word:
- return True
- else:
- return True
- words_to_check = ["a", "zombie", "transceiver", "veil", "icier"]
- for word in words_to_check:
- print(CheckRule(word))
Add Comment
Please, Sign In to add comment