Inspired by the inline-repl feature from Simple GHC (Haskell) Integration for VSCode, the extension python-inline-repl can run Python codes within comments and preserve the result in your file.
Advantages for learners:
- No need to open another tab for running/showing the code
- Results are saved in the file so that you know what examples you have tried
- Allows the instructors to create exercises easily by leaving results as specifications (see the GIF)
- Further allows students to only focus on one file. No README, no write-up
- Also allows students to easily compare their output against the output from instructors by putting two comment blocks together