This is a sort of Public Service Announcement. One of the great things about Org mode is the code block where you can run code in an Org buffer and have the results inserted into the Org document. I use this all the time. It’s a particularly elegant way of practicing literate programming and writing “live” documents that automatically rewrite themselves when the data the changes.
It’s usually a seamless process but there are gotchas for some languages. Sadly, Python, a widely used language, is one of those where you have to be careful. If you don’t follow the rules correctly, you can end up with erroneous results.
Recently, on the Org Mode mailing list there was a nice discussion of the problems that Python can present. As of right now, there are only three posts in the thread so you should read them all to get a full idea of what’s going on. The TL;DR is that you (usually) have to provide an explicit return
in your Python code to get the correct results into your Org buffer.
Python is the only language that I use—even occasionally—that has these problems: usually things just work. It is, therefore, worth spending a few minutes familiarizing yourself with the problems that Python and a few other languages have in the Babel environment.