Free recommended code sharing sites?

I’m fairly new to Python, I still have not finished my first Python tutorial. Sometimes it’s easier to share longer code (50+ lines) on a code sharing website. Besides, what are recommended code sharing sites when asking questions on a forum about Python?

EDIT: I was thinking of code longer than 50 lines when using an external code site.

I also like free and no ads. :slight_smile:

On this forum, it’s best to first condense your code down to the minimum that you need to share to ask your question, then just paste it into the message body within code fences (triple backticks, also accessible from the </> button in the formatting bar). For other forums, it’s up to their rules :slight_smile:


If you’re somewhere where you need long code and can’t embed it, I’d use, as that’s recommended by sopython and doesn’t annoy with ads like does.

(Uh… actually I’ve been using, as I thought that was the one they recommended. But both look alright.)

And I often use Attempt This Online since that lets people run the code there, with a relatively new Python version and no ads. And its copy-button gives me both the code and a link, e.g.:

import sys

print('hello world')

Attempt This Online!


Can also use GitLab Snippets, or GitHub Gist.

For example:

1 Like

“Attempt this online” has Python and Python 2 but no Python 3. I just did a language search for “Python”. I have Python 3.12. Does it support Python 3 but it’s called “Python”?

EDIT: Never mind, “Python” is Python 3.11.4. I did this.

import sys 
print ('Python %s on %s' % (sys.version, sys.platform))

You can safely bet that “Python” does not refer to Python 1.


Yeah, I only even know one site that offers Python 1 at all.

@c-rob From my post, you were also just two clicks away (the link and then Execute) from seeing the version …

I see what you mean now. All this Python stuff, and the Attempt This Online site is brand new to me. But I get it now.

You see I clicked on the first link for ATO, not the second one where you provided a program to run.