Use triple back-ticks to format the code.
And you can use a thread to answer someone’s question, then it is easier to follow conversation. Imagine if 5 questions will be discussed in parallel in the main thread.
And usually it is better to combine several consecutive messages into one.