Before knowing about running the Pyscript, first we need to know what is pyscript. I have written a separate article kindly check that one if you wish am leaving the link here.
PyScript has three main components for writing python in HTML.
- py-env defines the Python packages needed to run your Python code.
- py-script is where you write your Python code that gets executed within the web page.
- py-repl creates a REPL (read-eval-print loop) component that evaluates the code users enter and displays the results.
1.Create a HTML file.
2. Go to https://pyscript.net/ website.
3. Click on install. Copy the code and paste it on the <head> tag of the HTML file.
4. Use PyScript tags to run python code.
OUTPUT: