This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2022_Stanislav_Mykhailenko/Lesson_5/Task 2/webserver.py

18 lines
403 B
Python
Raw Permalink Normal View History

# Lesson 5 Task 2: web calculator
# Author: Stanislav Mykhailenko
# License: Unlicense
2023-01-01 20:01:06 +00:00
from flask import Flask, render_template, redirect, request
from datetime import datetime
app = Flask("Calculator")
@app.route('/')
def index():
result = None
if 'operation' in request.args:
result = eval(request.args.get('operation'))
return render_template("index.html", result=result)
app.run(port=8080)