I need help with my Python Flask application. I'm trying to give a user the result of a division that they specify, but it's not working. When the user submits "5" and "2" for example, it returns "2" instead of "2.5". I have no idea why it would do this.
Below is my code... can anybody figure out why this would happen?
from flask import Flask, session, render_template, request
app = Flask(__name__)
app.secret_key = 'wlFw0WP7SrNmAMF1wJaUSjWMTYdTay8EDIA3FPQhbo9c7wQ9rIdQrzJRzcN1o3mp'
@app.route('/',methods=['GET','POST'])
def index():
[...]
if request.method == 'POST':
a = int(request.form['a'])
b = int(request.form['b'])
result = a/b
return render_template('index.html',session=session,result=result)
return render_template('index.html',session=session)
# Other routes omitted
if __name__ == '__main__':
app.run(host='0.0.0.0')