If you mean python running on a server which creates an HTML page, yes that's possible although I'm not sure how to help you get started on doing that.
If you mean python code actually running in your browser, it may be a bit more complicated. If know or are willing to learn javascript, it might be easier to rewrite your code in that if it's not a lot. If you do want to use python, a quick google search has brought up this:
http://www.skulpt.org/ which, if you can get it to work, might do what you want. However it'll require some knowledge of javascript, and it looks like it supports python 2 rather than 3.
Also found this
http://pyjs.org/ which may help you do what you want. From what little I looked at it, it seems to compile your python code into javascript.
Keep in mind that I haven't used either of these so it's up to you to figure out how to use them.