The closure of this question seems rather rude to me, in particular in view of the strong gender bias on this site. -- Also I think neither its vote score nor that of its five upvoted answers supports the claim that it is considered off-topic on this site. Therefore I suggest to reopen that question.
As explained in the editing help, in MarkDown you can achieve preformatted text by using four spaces indentation.
To achieve this after typing (or copy pasting) the code, simply select the relevant part and the click on the code button in the editor (between blockquote and insert image) or press Ctrl+K.
To test this I have taken an example of for cycle in ...