With Brython you can write browser programs in Python instead of Javascript, by inserting Python code in an HTML page by:
<script type="text/python"> ... </script>
Usage:
pip install brython
Then in an empty folder:
python -m brython --install
or in a folder with older versions already present:
python -m brython --update
The package includes a page demo.html with examples of use. For more information see the Brython site.