29 lines
		
	
	
		
			836 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			836 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from flask import Flask, render_template, url_for, request, redirect, Response, abort, session
 | 
						|
from flask_sqlalchemy import SQLAlchemy
 | 
						|
from datetime import datetime
 | 
						|
import magic
 | 
						|
import random
 | 
						|
import string
 | 
						|
 | 
						|
 | 
						|
app = Flask(__name__)
 | 
						|
app.secret_key = 'eng5iikeiwah3lae4idoo0woh4eiy6Th'
 | 
						|
 | 
						|
@app.route('/', methods = ['GET', 'POST'])
 | 
						|
def index():
 | 
						|
    if request.method == 'POST':
 | 
						|
        alle = []
 | 
						|
        zufall = []
 | 
						|
        for r in request.form.getlist('rechenreihen'):
 | 
						|
            for i in range(1,11):
 | 
						|
                alle.append({str(r)+"x"+str(i): int(r)*int(i) })
 | 
						|
 | 
						|
        while len(alle):
 | 
						|
            zufall.append(alle.pop(random.randint(0,len(alle)-1)))
 | 
						|
        return render_template('arbeitsblatt.html',aufgaben=zufall)
 | 
						|
    else:
 | 
						|
        return render_template('generator.html')
 | 
						|
 | 
						|
 | 
						|
if __name__ == "__main__":
 | 
						|
    app.run(debug=True) |