forked from krishnaik06/Flask-Web-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
33 lines (25 loc) · 751 Bytes
/
app.py
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
### Building Url Dynamically
####Variable Rules And URL Building
from flask import Flask,redirect,url_for
import pandas
app=Flask(__name__)
@app.route('/')
def welcome():
return 'Welcome to my Youtube Channel'
@app.route('/success/<int:score>')
def success(score):
return "<html><body><h1>The Reult is passed</h1></body></html>"
@app.route('/fail/<int:score>')
def fail(score):
return "The Person has failed and the marks is "+ str(score)
### Result checker
@app.route('/results/<int:marks>')
def results(marks):
result=""
if marks<50:
result='fail'
else:
result='success'
return redirect(url_for(result,score=marks))
if __name__=='__main__':
app.run(debug=True)