diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..21279a3 Binary files /dev/null and b/.DS_Store differ diff --git a/flask_calc.py b/flask_calc.py new file mode 100644 index 0000000..752d990 --- /dev/null +++ b/flask_calc.py @@ -0,0 +1,20 @@ +from flask import Flask, render_template, request + +calc_app = Flask(__name__) + +@calc_app.route('/') +def form(): + return render_template('calculator.html') + + +@calc_app.route('/calculator', methods=["POST"]) +def calculate(): + first = str(request.form['first']) + operator = str(request.form['operator']) + second = str(request.form['second']) + result = eval(first+operator+second) + return render_template("calc_result.html", result=result) + + +if __name__ == "__main__": + calc_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_result.html b/templates/calc_result.html new file mode 100644 index 0000000..0757e31 --- /dev/null +++ b/templates/calc_result.html @@ -0,0 +1,37 @@ + + + CALC MORE! + + + +

Your Answer:

+ {{ result }} + +

+ Math Rules +

Let's do some more MATH!!!

+ Input 2 values and select an operator. +
+
+ First Value: + +
+
+ +
+
+ Second Value: + +
+ +
+ + diff --git a/templates/calculator.html b/templates/calculator.html new file mode 100644 index 0000000..359dc13 --- /dev/null +++ b/templates/calculator.html @@ -0,0 +1,31 @@ + + + Calc that! + + + +

Python Web Calculator

+ Input 2 values and select an operator. +
+
+ First Value: + +
+
+ +
+
+ Second Value: + +
+ +
+ +