Formatting a python source file in a new post

I am trying to post a new topic that includes some python code and I cannot figure out how to properly format the code. I tried the Preformatted text toolbar button as follows:
The following is just a short example. I clicked on the preformatted text buttom at the start and end of my three line example.
Preformatted texta=1
while a<=30
z=3Preformatted text

You can select the entire block and click “preformatted text” and it will surround it with triple backticks, ```, like this:

a=1
while a<=30
z=3

Please see the pinned thread to understand how this works.

thanks much, i did not select the text beforehand