During my glorious conquer of codingbat.com , I did one good thing to understand my code - lots and lost of print statements!
When you encounter problem, or your code works wrong way, you should clearly see whats happening inside it.
so when i solve a problem from online judges, I will not only put hints or solutions - I will also put lots of prints in my code so you guys can copypaste and try it
And trust me, my print statements will be very helpful and informative!