from flask import Flask, render_template from functools import reduce from operator import mul app = Flask(__name__) @app.route('/factorial/') def index(number): factorial = reduce(mul, range(1,number+1)) return render_template('factorial.html', number=number, factorial=factorial) if __name__ == '__main__': app.run()