Skip to content

Instantly share code, notes, and snippets.

@plasmatic1
Created April 26, 2019 14:33
Show Gist options
  • Save plasmatic1/41c81277eec30e381c302d6d445c8100 to your computer and use it in GitHub Desktop.
Save plasmatic1/41c81277eec30e381c302d6d445c8100 to your computer and use it in GitHub Desktop.
Conditional Practice
from random import choice, sample, randint
suj = ['Je', 'Tu', 'Il', 'Elle', 'Nous', 'Vous', 'Ils', 'Elles', 'On']
ends = ['ais', 'ais', 'ait', 'ait', 'ions', 'iez', 'aient', 'aient', 'ait']
vb = ['aller', 'avoir', 'être', 'faire', 'pouvoir', 'devoir', 'savoir', 'venir', 'voir', 'vouloir']
pt = ['ir', 'aur', 'ser', 'fer', 'pourr', 'devr', 'saur', 'viendr', 'verr', 'voudr']
assert len(suj) == len(ends)
assert len(vb) == len(pt)
while True:
print('Conjugate verbs!')
cis = randint(0, len(suj) - 1)
csuj = suj[cis]
cend = ends[cis]
ci = randint(0, len(vb) - 1)
cvb = vb[ci]
cpt = pt[ci]
print('Conjugate %s + %s:' % (csuj, cvb))
ret = input()
f = csuj + ' ' + cpt + cend
if f.lower() != ret.lower():
print('Incorrect! Answer is "%s"' % f)
else:
print('Correct!')
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment