DEV Community

Medea
Medea

Posted on

8 2

Tenses of verbs - Python

My aim is to make multiple tables with the Latin and then the English translation.
So I've got this code so far:

firstconjugationtenses = {'present': ['am-o', 'ama-s', 'ama-t', 'ama-mus', 'ama-tis', 'ama-nt'], 'imperfect': ['ama-bam', 'ama-bas', 'ama-bat', 'ama-bamus', 'ama-batis', 'ama-bant'], 'future': ['ama-bo', 'ama-bis', 'ama-bit', 'ama-bimus', 'ama-bitis', 'ama-bunt'], 'perfect': ['amav-i', 'amav-isti', 'ama-vit', 'ama-vimus', 'ama-vistis', 'ama-verunt']}
firstconjugationverbs = {"am-o": "love"}

firstprincipalpart = firstconjugationtenses['present'][0]
englishverb = firstconjugationverbs[firstprincipalpart]
firstprincipalpart = firstprincipalpart.replace("-", "")
print(firstprincipalpart + " - I " + englishverb)
for tense in firstconjugationtenses.keys():
  print("\033[1m" + tense.title() + "\033[0m")
  persons = firstconjugationtenses[tense]
  for person in persons:
    if tense == "present":
      if persons.index(person) == 0:
        print(f"{person}: I {englishverb}")
      elif persons.index(person) == 1:
        print(f"{person}: You {englishverb} (sg.)")
      elif persons.index(person) == 2:
        print(f"{person}: He/she/it {englishverb}s")
      elif persons.index(person) == 3:
        print(f"{person}: We {englishverb}")
      elif persons.index(person) == 4:
        print(f"{person}: You {englishverb} (pl.)")
      elif persons.index(person) == 5:
        print(f"{person}: They {englishverb}")
    elif tense == "future":
      if persons.index(person) == 0:
        print(f"{person}: I shall {englishverb}")
      elif persons.index(person) == 1:
        print(f"{person}: You will {englishverb} (sg.)")
      elif persons.index(person) == 2:
        print(f"{person}: He/she/it will {englishverb}")
      elif persons.index(person) == 3:
        print(f"{person}: We will {englishverb}")
      elif persons.index(person) == 4:
        print(f"{person}: You will {englishverb} (pl.)")
      elif persons.index(person) == 5:
        print(f"{person}: They will {englishverb}")
    elif tense == "perfect":
      if persons.index(person) == 0:
        print(f"{person}: I used to {englishverb}")
      elif persons.index(person) == 1:
        print(f"{person}: You used to {englishverb} (sg.)")
      elif persons.index(person) == 2:
        print(f"{person}: He/she/it used to {englishverb}")
      elif persons.index(person) == 3:
        print(f"{person}: We used to {englishverb}")
      elif persons.index(person) == 4:
        print(f"{person}: You used to {englishverb} (pl.)")
      elif persons.index(person) == 5:
        print(f"{person}: They used to {englishverb}")
    elif tense == "imperfect":
      if persons.index(person) == 0:
        print(f"{person}: I have {englishverb}d")
      elif persons.index(person) == 1:
        print(f"{person}: You have {englishverb}d (sg.)")
      elif persons.index(person) == 2:
        print(f"{person}: He/she/it has {englishverb}d")
      elif persons.index(person) == 3:
        print(f"{person}: We have {englishverb}d")
      elif persons.index(person) == 4:
        print(f"{person}: You have {englishverb}d (pl.)")
      elif persons.index(person) == 5:
        print(f"{person}: They have {englishverb}d")
Enter fullscreen mode Exit fullscreen mode

This code outputs:

amo - I love
Present
am-o: I love
ama-s: You love (sg.)
ama-t: He/she/it loves
ama-mus: We love
ama-tis: You love (pl.)
ama-nt: They love
Imperfect
ama-bam: I have loved
ama-bas: You have loved (sg.)
ama-bat: He/she/it has loved
ama-bamus: We have loved
ama-batis: You have loved (pl.)
ama-bant: They have loved
Future
ama-bo: I shall love
ama-bis: You will love (sg.)
ama-bit: He/she/it will love
ama-bimus: We will love
ama-bitis: You will love (pl.)
ama-bunt: They will love
Perfect
amav-i: I used to love
amav-isti: You used to love (sg.)
ama-vit: He/she/it used to love
ama-vimus: We used to love
ama-vistis: You used to love (pl.)
ama-verunt: They used to love
Enter fullscreen mode Exit fullscreen mode

I'm fully aware that some verb's past endings are irregular, so is there any way I can get the verbs in different endings which match the person and tense, in a really easy way?

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay