t2a28-pyscript-fred.html

; Hello World let's do Python in the Browser!
This is the current date and time, as computed by Python: from datetime import datetime now = datetime.now() display(now.strftime("%m/%d/%Y, %H:%M:%S"))

Now some input and output

Multiply by 3:
from js import document def multiply_by_three(event=None): myNumber = document.getElementById("myIn01").value myResult = int(myNumber) * 3 document.getElementById("myOut01").innerText = f"Result: {myResult}" # Attach the function to the button click event document.getElementById("myButton01").onclick = multiply_by_three