-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
40 lines (27 loc) · 969 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
34
35
36
37
38
39
40
from flask import Flask, render_template,request, jsonify, json
from switch_method import switch_method
app = Flask(__name__)
@app.route('/', methods=['POST', 'GET'])
def index():
Meth1 = []
Meth2 = []
max = []
value = []
if request.method == 'POST':
forms = {
'first': request.form['first'],
'second': request.form['second'],
'max': request.form['max'],
}
print(forms['first'])
print(forms['second'])
max = int(forms['max'])
Meth1 = forms['first']
Meth2 = forms['second']
steps1 = switch_method(forms['first'], max)
steps2 = switch_method(forms['second'], max)
value.append(round(steps1, 3))
value.append(round(steps2, 3))
return render_template("index.html", value=json.dumps(value), Meth1=Meth1, Meth2=Meth2, max=json.dumps(max))
if __name__ == '__main__':
app.run(debug=True)