Flask-Workshop/06-input-factorial.py

12 lines
344 B
Python

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