Rolling dice - randrange
- randrange
import random
print( 1 + int( 6 * random.random() ))
print(random.randrange(1, 7))
# One of the following: 1, 2, 3, 4, 5, 6
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
import random
print( 1 + int( 6 * random.random() ))
print(random.randrange(1, 7))
# One of the following: 1, 2, 3, 4, 5, 6