Adding python code to discourse replies

Hello colleagues,

For the last few years, it was possible to type python code in discourse.mcneel replies like this:

But it seems something changed recently.
Because upper syntax does not work anymore, and discourse automatically makes “Preformated text”, out of upper text:

image

Does anyone know, how can we add python code to a discourse reply?

Thank you very much for the help.

def hello_world():
    print("Hello from Python!")

Thank you Dale. For some reason, it does not work on my side anymore.
I immediately get the “Preformated text”.

I think you must have toggled into Rick Text Editor mode like this:

You can get back to the standard editor by clicking where marked, taking you back to:

Hi @jeremy5 ,

It worked perfectly!
Thank you very much for the help!

def Addition(a, b):
    c = a + b
    return c