Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def past_verb(s_verb):
- d = {'play': 'played',
- 'stop': 'stopped',
- 'go': 'gone',
- 'put': 'put'}
- str = d.get(s_verb)
- if str is None:
- # y -> ied
- if s_verb[-1:] == 'y':
- str = s_verb[:-1] + 'ied'
- # e -> ed
- elif s_verb[-1:] == 'e':
- str = s_verb[:-1] + 'ed'
- # c -> ked
- elif s_verb[-1:] == 'c':
- str = s_verb + 'ked'
- else :
- str = s_verb + 'ed'
- return str
- print(past_verb("play"))
- print(past_verb("like"))
- print(past_verb("try"))
- print(past_verb("stop"))
- print(past_verb("heat"))
- print(past_verb("picnic"))
- print(past_verb("go"))
- print(past_verb("put"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement