Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # A very simple grammar check program. if user types between you and I
- # it will tell the user the correct grammar is between you and me
- # it searches for the words between, for and with. It will then replace
- # I with me, he with him and she with her.
- import re
- userInput = raw_input("Please enter a sentence: ")
- if re.search ("between you and I", userInput):
- print "the correct grammar is:"
- print re.sub ("I", "me", userInput)
- if re.search ("for you and I", userInput):
- print "the correct grammar is:"
- print re.sub ("I", "me", userInput)
- if re.search ("with you and I", userInput):
- print "the correct grammar is:"
- print re.sub ("I", "me", userInput)
- if re.search ("between you and he", userInput):
- print "the correct grammar is:"
- print re.sub ("he", "him", userInput)
- if re.search ("for you and he", userInput):
- print "the correct grammar is:"
- print re.sub ("he", "him", userInput)
- if re.search ("with you and he", userInput):
- print "the correct grammar is:"
- print re.sub ("he", "him", userInput)
- if re.search ("between you and she", userInput):
- print "the correct grammar is:"
- print re.sub ("she", "her", userInput)
- if re.search ("for you and she", userInput):
- print "the correct grammar is:"
- print re.sub ("she", "her", userInput)
- if re.search ("with you and she", userInput):
- print "the correct grammar is:"
- print re.sub ("she", "her", userInput)
Advertisement
Add Comment
Please, Sign In to add comment