Skip to content

Instantly share code, notes, and snippets.

@swarba015
Created November 6, 2022 06:18
Show Gist options
  • Save swarba015/46cf757ad8161cee45e1dc5869158de4 to your computer and use it in GitHub Desktop.
Save swarba015/46cf757ad8161cee45e1dc5869158de4 to your computer and use it in GitHub Desktop.
For each word in words, add ‘d’ to the end of the word if the word ends in “e” to make it past tense. Otherwise, add ‘ed’ to make it past tense. Save these past tense words to a list called past_tense.
words = ["adopt", "bake", "beam", "confide", "grill", "plant", "time", "wave", "wish"]
past_tense = []
for i in words:
if i[-1] == "e":
i = i+ "d"
past_tense.append(i)
else:
i = i + "ed"
past_tense.append(i)
print(past_tense)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment