from bottle import route, run @route('/hello') def hello(): return "Hello World!" # Bonjour personnalisé @route('/hello/') def hello_user(name): return f"Hello {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" if __name__ == '__main__': run(host='localhost', port=38083, debug=True, reloader=True)