Jinja
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def mult_table():
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def mult_table():
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def mult_table():
return render_template("form.html")
<!DOCTYPE html>
<html>
<head>
<title>
Multiplication Table
</title>
</head>
<body>
<form action="/" method="post">
<input name="size" type="number" placeholder="dimension"/>
<input name="submit" type="submit" />
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>
Multiplication Table
</title>
</head>
<body>
<form action="/" method="post">
<input name="size" type="number" placeholder="dimension"/>
<input name="submit" type="submit" />
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>
Multiplication Table
</title>
</head>
<body>
<form action="/" method="post">
<input name="size" type="number" placeholder="dimension"/>
<input name="submit" type="submit" />
</form>
</body>
</html>
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def mult_table():
return render_template("form.html")
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def mult_table():
return render_template("form.html")
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def mult_table():
if request.method == "GET":
return render_template("form.html")
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def mult_table():
if request.method == "GET":
return render_template("form.html")
# our form is set up to submit via POST
elif request.method == "POST":
return render_template("table.html")
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
</td>
</tr>
</table>
</body>
</html>
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def mult_table():
if request.method == "GET":
return render_template("form.html")
# our form is set up to submit via POST
elif request.method == "POST":
return render_template("table.html")
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def mult_table():
if request.method == "GET":
return render_template("form.html")
# our form is set up to submit via POST
elif request.method == "POST":
return render_template("table.html", dim=request.form.get("size"))
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def mult_table():
if request.method == "GET":
return render_template("form.html")
# our form is set up to submit via POST
elif request.method == "POST":
return render_template("table.html", dim=request.form.get("size"))
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
// loop to repeat “dim” times (“dim” # of rows)
<tr>
// loop to repeat “dim” times (“dim” # of columns)
<td>
// print out that value of the cell between <td>s
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
{% for i in range(dim) %}
<tr>
// loop to repeat “dim” times (“dim” # of columns)
<td>
// print out that value of the cell between <td>s
</td>
</tr>
{% endfor %}
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
{% for i in range(dim) %}
<tr>
{% for j in range(dim) %}
<td>
// print out that value of the cell between <td>s
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
{% for i in range(dim) %}
<tr>
{% for j in range(dim) %}
<td>
{{ (i + 1) * (j + 1) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
{% for i in range(dim) %}
<tr>
{% for j in range(dim) %}
<td>
{{ (i + 1) * (j + 1) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table>
{% for i in range(dim|int) %}
<tr>
{% for j in range(dim|int) %}
<td>
{{ (i + 1) * (j + 1) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Table</title>
</head>
<body>
<table border=1>
{% for i in range(dim|int) %}
<tr>
{% for j in range(dim|int) %}
<td>
{{ (i + 1) * (j + 1) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</body>
</html>
It may not look beautiful… but that’s what CSS is for!