SHARE
TWEET

Untitled

a guest Jul 17th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python3
  2.  
  3.  
  4. def past_verb(v):
  5.     vdict = {"be": "been", "go": "gone", "put": "put", "picnic": "picnicked"}
  6.     pp = v +"ed"
  7.     if v in vdict:
  8.         pp = vdict[v]
  9.     else:
  10.         if v[-1] is 'e':
  11.             pp = v + "d"
  12.         elif v[-1] is 'y':
  13.             if len(v) > 2 and v[-2] not in "aeiou":
  14.                 pp = v[0:-1] + "ied"
  15.         elif v[-1] not in "aeiou":
  16.           if len(v) > 2 and v[-2] in "aeiou":
  17.             if len(v) > 3 and v[-3] not in "aeiou":
  18.               pp = v + v[-1] + "ed"
  19.     return pp
  20.  
  21. print(past_verb("play"))
  22. print(past_verb("like"))
  23. print(past_verb("try"))
  24. print(past_verb("stop"))
  25. print(past_verb("heat"))
  26. print(past_verb("picnic"))
  27. print(past_verb("go"))
  28. print(past_verb("put"))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top