from aiohttp import web import random gen = random.Random() gen.seed(340) routes = web.RouteTableDef() @routes.get("/") async def root(req): rolls = [gen.randrange(1,7) for roll in range(3)] eqn = " + ".join(str(roll) for roll in rolls) tot = sum(rolls) return web.Response(text=f'<div style="font-size:4vw">You roll three dice and get {eqn} = <strong>{tot}</strong><div>', content_type='text/html') if __name__ == '__main__': app = web.Application() app.add_routes(routes) web.run_app(app)