gemischteAufgaben 0 < e < 100

This commit is contained in:
2021-06-12 13:40:36 +02:00
parent a487d6d70b
commit ca961ca89b
2 changed files with 13 additions and 4 deletions

13
app.py
View File

@@ -43,16 +43,25 @@ def index():
else:
count = len(alle)
for i in range(1,count):
while count > 1:
if len(alle) == 0:
break
term = alle.pop(random.randint(0,len(alle)-1))
term.c = ''
if request.form.get('gemischteAufgaben'):
maxValue = eval(str(term.a) + term.t.typ + str(term.b))
term.c += ' + ' if random.randint(0,1) else ' - '
if random.randint(0,1):
term.c += ' + '
t = int(100 - maxValue)
maxValue = t
else:
term.c += ' - '
if maxValue <= 1:
alle.append(term)
continue
term.c += str(random.randint(1,maxValue))
zufall.append(term)
count -= 1
return render_template('arbeitsblatt.html',aufgaben=zufall,maxPerPage=int(request.form.get('maxPerPage')))
else:
return render_template('generator.html', reihen=rt_rechenreihen)