I am new to programming and am learning Python via Udemy's complete python bootcamp course.
I was working on a project given in the course of making a Tic-Tac-Toe game and got confused.
import random2
def choose_first():
if random2.randint(0, 1) == 0:
return 'Player 2'
else:
return 'Player 1'
in the above code random2.randint(0, 1)
is for commanding python to choose a random value between the range (0,1)
but shouldn't the range mentioned in the code be between 0
and 0
? since the 1
represents up to the given range, meaning taking numbers before this digit but the code works fine and the value of 0
and 1
is generated.
Why is that? What am i not understanding?
Thank you