I'm trying to post a sample of code that looks like this:
Look at all of those comments, and it still won't allow me post! What am I doing wrong?
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.Sign up to join this community
Ideally, you'd add as much clarification and context as you could outside the code block, since you're no longer constrained to mixing code and meta-information about the code.
From a cursory examination of your screenshot, the comments appear to be inserted by a TA or instructor as part of a course you're completing, and are probably not particularly relevant to your question. Remove them, and summarise the necessary details outside the code block.
In your above mentioned image it displays clearly that it only contains only code, and as paxdiablo said Comments in the code are still considered code.
You have to post only relevant code in your question not the unnecessary things like(comments) with it. Also what problem you are facing and the explanation of desired output should be added in your question as detail.
When I read a question, I usually read all of the text first, skipping the code. Then when I have understood the context, I go back and examine the parts of the code that relate to the question.
If the comments are inline, they often go unnoticed. For this reason, it may help readers of your question to place the problem description outside the code block itself.
Additionally, consider the fact that we often are asked to troubleshoot code that is not exactly like the original, real-life code. This code has been modified by the OP in an attempt to bring clarity or simplicity. In many cases, it simply obscures the problem or introduces new ones. If you are modifying your code to add the comments before posting it here, you are presenting code that doesn't match your real-life situation. If your edits modify the functionality of the code in any way (even accidentally) they may make answering more difficult.