-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
72 lines (63 loc) · 2.81 KB
/
server.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from flask import Flask, redirect, render_template, request, url_for
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def index():
if request.method == "GET":
return render_template("index.html")
@app.route("/web", methods=['GET', 'POST'])
def web1():
if request.method == "GET":
return render_template("web.html")
elif request.method == "POST":
print(request.form['usn'])
print(request.form['metod1']+"\n"+request.form['metod2']+"\n"+request.form['metod3']+"\n"+request.form['metod4']+"\n"+request.form['metod5']+"\n"+request.form['metod6']+"\n"+request.form['metod7']+"\n"+request.form['metod8']+"\n"+request.form['metod9']+"\n"+request.form['metod10'])
f = open("resultsweb.txt", "a")
scr=0
l1 = ["C", "D", "B", "B", "D", "D", "C", "C", "B", "D"]
for i in range(0,10):
if l1[i]==request.form['metod'+str(i+1)]:
scr=scr+1
f.write(request.form['usn']+"\t"+str(scr)+"\n")
f.close()
return render_template("success.html",score=str(scr),usn=request.form['usn'])
@app.route("/ml", methods=['GET', 'POST'])
def ml1():
if request.method == "GET":
return render_template("ml.html")
elif request.method == "POST":
print(request.form['usn'])
print(request.form['metod1'] + "\n" + request.form['metod2'] + "\n" + request.form['metod3'] + "\n" +
request.form['metod4'] + "\n" + request.form['metod5'] + "\n" + request.form['metod6'] + "\n" +
request.form['metod7'] + "\n" + request.form['metod8'] + "\n" + request.form['metod9'] + "\n" +
request.form['metod10'])
f = open("resultsml.txt", "a")
scr = 0
l1 = ["B", "D", "B", "A", "D", "C", "A", "D", "B", "B"]
for i in range(0, 10):
if l1[i] == request.form['metod' + str(i + 1)]:
# print(i, l1[i], request.form['metod' + str(i + 1)])
scr = scr + 1
f.write(request.form['usn'] + "\t" + str(scr) + "\n")
f.close()
return render_template("success.html", score=str(scr), usn=request.form['usn'])
@app.route("/mobile", methods=['GET', 'POST'])
def mobile1():
if request.method == "GET":
return render_template("mobile.html")
elif request.method == "POST":
print(request.form['usn'])
print(request.form['metod1'] + "\n" + request.form['metod2'] + "\n" + request.form['metod3'] + "\n" +
request.form['metod4'] + "\n" + request.form['metod5'] + "\n" + request.form['metod6'] + "\n" +
request.form['metod7'] + "\n" + request.form['metod8'] + "\n" + request.form['metod9'] + "\n" +
request.form['metod10'])
f = open("resultsmobile.txt", "a")
scr = 0
l1 = ["B", "D", "B", "A", "A", "C", "C", "B", "B", "B"]
for i in range(0, 10):
if l1[i] == request.form['metod' + str(i + 1)]:
scr = scr + 1
f.write(request.form['usn'] + "\t" + str(scr) + "\n")
f.close()
return render_template("success.html", score=str(scr), usn=request.form['usn'])
if __name__ == '__main__':
app.run(debug=True,host="0.0.0.0")