Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- changeWords(“I can't eat") -> “I can not eat"
- changeWords(“I don't like swimming.”) -> “I do not like swimming.”
- changeWords(“I shouldn't do that.”) -> “I should not do that.”
- def stringChange(a):
- a = ""
- for line in stringChange("a"):
- line = text.replace("a","can't","can not")
- if not line: break
- return line
- >>> def changeWords(s):
- for old, new in (
- ("can't", "can not"),
- ("shouldn't", "should not"),
- ("don't", "do not"),
- ):
- s = s.replace(old, new)
- return s
- >>> changeWords("I don't know how to do this")
- 'I do not know how to do this'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement