An Interest In:
Web News this Week
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
May 26, 2022 07:47 pm GMT
Original Link: https://dev.to/vulcanwm/tenses-of-verbs-python-20mh
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")
This code outputs:
amo - I lovePresentam-o: I loveama-s: You love (sg.)ama-t: He/she/it lovesama-mus: We loveama-tis: You love (pl.)ama-nt: They loveImperfectama-bam: I have lovedama-bas: You have loved (sg.)ama-bat: He/she/it has lovedama-bamus: We have lovedama-batis: You have loved (pl.)ama-bant: They have lovedFutureama-bo: I shall loveama-bis: You will love (sg.)ama-bit: He/she/it will loveama-bimus: We will loveama-bitis: You will love (pl.)ama-bunt: They will lovePerfectamav-i: I used to loveamav-isti: You used to love (sg.)ama-vit: He/she/it used to loveama-vimus: We used to loveama-vistis: You used to love (pl.)ama-verunt: They used to love
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?
Original Link: https://dev.to/vulcanwm/tenses-of-verbs-python-20mh
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To