For a few months (ever since I started teaching Intro to CS in Python), I’ve been looking for the easiest way to get brand new students practicing with writing Python as quickly as possible. I soon was convinced that being able to run Python code in the browser was what I really wanted (since trying to support all of them getting set up with their own machines takes a while). While there are great websites out there that let you run Python in the browser, they all require that I send students to that third-party site, which is an extra step that I chafed at. I felt like there had to be an easy way to give them a space to try things out right on this website (since I send them here for readings and labs anyway), but I couldn’t find quite what I was looking for.
That just looks like this:
<py-repl id="my-repl"> test=2 print(test) </py-repl>