I don't think it's a good idea to post your attempt at an answer. If you're not sure about it, then it is more a part of the question. If you figure it out after asking, though, go ahead and post your new solution.

I include my attempt in the question. I start by stating the problem, which I highlight with a `>` to make it stand out. Then I give my general thoughts about the problem ("I think I should approach it like this but I'm not quite sure about this other thing") and put bullets in front of any additional specific questions that brings up. At the end, I post my attempt below a horizontal rule labelled with "My Attempt." In doing so, I mean to imply that it's okay if you'd rather just post your own solution instead of 'debugging' mine, but that my solution is there if you want it. I also find it to be good practice to outline what I'm going to do in the first paragraph of the proof, in the spirit of "tell them what you're going to say, say it, then tell them what you said."

One important thing I should add is that for every question I have asked like this, there are about 10 questions that I was *going* to ask, but figured it out while attempting to write a presentable question. In other words, my primary reason for encouraging that users show their work in homework questions is that I know from experience that it teaches. (Similarly, at least a third of my education was gained from trying not to look stupid while emailing the professor for help.)