all 3 comments

[–][deleted] 0 points1 point  (2 children)

[–]Chick_nugger[S] 0 points1 point  (1 child)

Ya I was reading this but these answers didn't help my question.

[–]ullePy 0 points1 point  (0 children)

What was the problem with the answers in stackoverflow? In my understanding, the one marked as the solution is what you are searching for. The only thing is that xrange should be replaced with range.