-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
46 lines (31 loc) · 895 Bytes
/
app.py
File metadata and controls
46 lines (31 loc) · 895 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
44
45
46
# ###1st Tutorial
# from flask import Flask
# ### WSGI application
# app = Flask(__name__)
# @app.route('/')
# def welcome():
# return "Vanakkam this is Dhivu"
# if __name__=="__main__":
# app.run(debug=True)
###### Dynamic URL
from flask import Flask , redirect , url_for
app = Flask(__name_)
@app.route('/')
def welcome():
return "Welcome to results page"
@app.route('/passed/<int:score>')
def passed(score):
return "You passed in the exam and your mark is " + str(score)
@app.route('/failed/<int:score>')
def failed(score):
return "You failed in the exam and your mark is " + str(score)
@app.route('/results/<int:marks>')
def results(marks):
result = ""
if marks > 40 :
result = "passed"
else :
result = "failed"
return redirect(url_for(result , score = marks))
if __name__=="__main__":
app.run(debug=True)