fix by lena
This commit is contained in:
28
lab2/app.py
28
lab2/app.py
@@ -17,6 +17,27 @@ def to_str(arr):
|
||||
return ",".join(list(map(str, arr)))
|
||||
|
||||
|
||||
def to_normal_numb(numb):
|
||||
str_numb = str(numb)
|
||||
index_point = str_numb.find(".")
|
||||
end_num = ""
|
||||
|
||||
if index_point == -1:
|
||||
index_point = len(str_numb)
|
||||
else:
|
||||
end_num = str_numb[index_point:]
|
||||
|
||||
normal_numb = ""
|
||||
count = 0
|
||||
|
||||
for i in range(index_point - 1, -1, -1):
|
||||
normal_numb = str_numb[i] + normal_numb
|
||||
count += 1
|
||||
if count % 3 == 0:
|
||||
normal_numb = " " + normal_numb
|
||||
return normal_numb + end_num
|
||||
|
||||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
if request.method == "POST":
|
||||
@@ -71,7 +92,12 @@ def index():
|
||||
"index.html",
|
||||
result=True,
|
||||
log=HookJeeves.result_log,
|
||||
extreme={"x": x, "val": val, "x_err": x_err, "type": target},
|
||||
extreme={
|
||||
"x": x,
|
||||
"val": to_normal_numb(val),
|
||||
"x_err": x_err,
|
||||
"type": target,
|
||||
},
|
||||
form_data={
|
||||
"x0": to_str(data["x0"]),
|
||||
"delta0": to_str(data["delta0"]),
|
||||
|
||||
Reference in New Issue
Block a user