-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
30 lines (27 loc) · 812 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
from flask import Flask, request, render_template
import knapsack
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
number_of_item = request.form['number_of_item']
nama_makanan = request.form['nama_makanan']
value_makanan = request.form['value_makanan']
harga_makanan = request.form['harga_makanan']
uang = request.form['uang']
return render_template(
'index.html',
data= knapsack.kalkulasi(
number_of_item,
nama_makanan,
value_makanan,
harga_makanan,
uang
)
)
return render_template(
"index.html",
data=""
)
if __name__ == "__main__":
app.run()