diff --git a/calc_app.py b/calc_app.py new file mode 100644 index 0000000..ea25cad --- /dev/null +++ b/calc_app.py @@ -0,0 +1,17 @@ +from flask import Flask, render_template, request +import random +app = Flask(__name__) + +@app.route("/") +def hello_form(): + return render_template("calc_main.html") + +@app.route("/calc", methods=["POST"]) +def say_hello(): + math_string = request.form['first'] + request.form['operators'] + \ + request.form['second'] + + return render_template("calc.html", name=eval(math_string)) + +if __name__ == "__main__": + app.run(debug=True) diff --git a/templates/.DS_Store b/templates/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/templates/.DS_Store differ diff --git a/templates/calc.html b/templates/calc.html new file mode 100644 index 0000000..f308685 --- /dev/null +++ b/templates/calc.html @@ -0,0 +1,30 @@ + + + + web calculator 0.1 + + +
+

+

Calculator

+

+

+ +

+

+ +

+ +

+ +

+ +

+
+ + diff --git a/templates/calc_main.html b/templates/calc_main.html new file mode 100644 index 0000000..498fb41 --- /dev/null +++ b/templates/calc_main.html @@ -0,0 +1,30 @@ + + + + web calculator 0.1 + + +
+

+

Calculator

+

+

+ +

+

+ +

+ +

+ +

+ +

+
+ +