-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
43 lines (30 loc) · 1005 Bytes
/
app.py
File metadata and controls
43 lines (30 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from flask import Flask, redirect, url_for, render_template, request
app=Flask(__name__)
@app.route('/')
def welcome():
return render_template("index.html");
@app.route('/success/<int:score>')
def success(score):
return render_template("result.html", score=score)
@app.route('/fail/<int:score>')
def fail(score):
return render_template("result.html", score=score)
@app.route('/result/<int:marks>')
def resultpage(marks):
result =""
if marks > 35:
result = "success"
else:
result = "fail"
return redirect(url_for(result, score=marks))
@app.route('/submit', methods=["GET", "POST"])
def submit():
if request.method == "POST":
fname = request.form['fname']
lname = request.form['lname']
marks = int(request.form['marks'])
print(fname, lname)
return redirect(url_for("resultpage", marks=marks))
return
if __name__=='__main__':
app.run(debug=True)