Flask-Workshop/06-input-factorial.py

12 lines
344 B
Python
Raw Normal View History

2020-11-22 13:41:09 +00:00
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()