Hide


#1

Why do we using randint(0, len(board) - 1), not randint(0, len(board))?
Can someone explain me?


#2

Because of zero-indexing. We need a random number 0..4, not 1..5, or 0..5. There is a fifth element, but it is at index 4.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.