SHARE
TWEET

Untitled

a guest Jul 17th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def past_verb(present_verb):
  2.     ret = ""
  3.     irregular_forms = {"go": "gone"}
  4.     single_forms = ["cut", "put"]
  5.     vowels = ['a', 'e', 'i', 'o', 'u', 'y']
  6.     if present_verb.lower() in single_forms:
  7.         return present_verb
  8.     if present_verb.lower() in irregular_forms:
  9.         return irregular_forms[present_verb.lower()]
  10.     if present_verb[-1] == "e":
  11.         ret = present_verb+"d"
  12.     elif present_verb[-1] == "y":
  13.         if present_verb[-2] in vowels:
  14.             ret = present_verb+"ed"
  15.         else:
  16.             ret = present_verb[:-1]+"ied"
  17.     else:
  18.         ret = present_verb+"ed"
  19.     return ret
  20.  
  21.  
  22. print(past_verb("play"))
  23. print(past_verb("like"))
  24. print(past_verb("try"))
  25. print(past_verb("stop"))
  26. print(past_verb("heat"))
  27. print(past_verb("picnic"))
  28. print(past_verb("go"))
  29. 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
 
Top