from bottle import route, run, template # Page d'accueil @route('/') def index(): return template('index.html') # Bonjour personnalisé @route('/hello/') def hello_user(name): return template('hello_user.html', name=name) # Calcul @route('/calcul///') def calcul(op, a, b): match op: case 'add': return f"resultat = {a + b}" case 'sub': return f"resultat = {a - b}" case 'mul': return f"resultat = {a * b}" case 'div': return f"resultat = {a / b}" case _: return "opérateur inconnu" # Table de multiplication @route('/tabmul/') def tabmul(nb): return template('tabmul.html', nb=nb) if __name__ == '__main__': run(host='localhost', port=38083, debug=True, reloader=True)