Question 31
Consider the following flask application.
from flask import Flask, render_template, requestapp = Flask(__name__)
@app.route('/')def out(): val = request.args
if val['num'] == '': return "<h1>Enter a valid number</h1>" elif val['num'].isalpha()==True: return "<h1>Invalid number</h1>" else: out = (val['num']) + (val['num']) return f'<h1>{out}</h1>'
if(__name__ == "__main__"): app.run(debug=True)If this flask app is running locally on http://localhost:5000, what is the output for the following URL?
For input: http://localhost:5000/?num=343