Create.withcode.uk is designed to allow anyone to write, run, debug and share python code that runs in your browser. It’s designed primarily for use in schools to allow teachers to quickly share code with students that they can adapt, debug and use.
Here’s an example python program that asks you for your name then says hello. Press Ctrl + Enter (or click on the green plus at the bottom of the code screen) to run the code.
When you save some python code on create.withcode.uk (press Ctrl+S or click on the share button) you get an option to copy and paste some HTML code that can be embedded into any website. e.g:
<iframe frameborder="0" width="100%" height="400px" src="https://create.withcode.uk/embed/7A"><a target="_blank" href="https://create.withcode.uk/python/7A">create.withcode.uk</a></iframe>
To make it even easier to embed your python projects into your blog or website, I’ve shared a plugin for wordpress that lets you quickly add python code using a wordpress shortcode.
This makes sharing your python projects much simpler:
- Write your code on create.withcode.uk
You don’t need an account – just type in your python code into the browser & test it with either Ctrl + Enter to run the whole project or Ctrl + . to run it one line at a time
- Save your code
Press Ctrl + S or click on the share button. This make your code available to anyone with the link.
The URL will be something like https://create.withcode.uk/python/ra
Note the letters and numbers at the end of the URL (ra in the above example)
- Add your code to any post or page in your wordpress blog using a shortcode:
Use a shortcode that contains the letters and numbers from the previous step:
This will display the python source code in your blog page or post. People viewing your website will be able to view, run and debug your code.
- If you want your code to run by default rather than show the source code:
Adapt the shortcode to change the mode to “run”:
Click here to download the wordpress plugin or to find out more.
Like create.withcode.uk, the wordpress plugin is free and open source.