1 | initial version |
I have two suggestions on this topic:
First, you should only show the source code if it is written clearly enough to be understood by students. Showing them something incomprehensible will probably have the opposite of the effect you would like. Python makes it pretty easy to write code that's readable by people with programming experience, but if that's not true of your students you'll have to take extra care and you might decide that effort isn't worth it.
Second, in an html format you can make showing the source optional. A button that says "Show source code" could open it in a popup window, or create a new tab with the source code and a fresh copy of the interact so they can play right there, or just unhide it on the current page.