You need some kind of framework to get it to work. There are a few frameworks for python for example django or flask. With flask you would then deploy your website on the localhost or on some provider like Heroku.
One option using flask and python would be:
import flask
app = Flask(__name__)
def sum(x,y):
return x+y
@app.route('/')
@app.route('/index')
def index():
dic = {'value': sum(x,y)}
return '''
<html>
<head>
<title>Home Page</title>
</head>
<body>
<h1>Hello, your sum is ''' + dic['value'] + '''!</h1>
</body>
</html>'''
That's an example for it, but be sure to check out maybe:
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
Moreover this is the easy solution. The more professional would be using flask and render_template
html = "your html {} your html".format(sum(2,3))to generate string with all your HTML and result fromsum()and which you have to save in file -web.html. But if you what to send it to client then you still need www server - so better use Flask, Django or other web framework.