-4

So im trying to make a russian roulette game in python, and I need to like make it so that every time its that persons turn, and they spin the revolver, it selects a number from like 0 through 6 But is there a way I can like redefine the like random variable? Like what I mean is that if I make variable thing = random.randrange(0,6) How would i like make thing equal to another random number from 0 through 6? I think I explained it sort of but how would I do this? Im pretty good at programming but for some reason I just cant remember or know how to do it... Also one quick question If I did the like thing = random.randrange(0,6) thing would it give me a random number that is either, 0,1,2,3,4,5,6 or would it be like 1,2,3,4,5 Thanks!

2 Answers2

1

what about random.randrange(1, 7)?

As you can read here the stop parameter won't be included while the start one will be.

Daniele Pantaleone
  • 2,657
  • 22
  • 33
1

You need the random module:

import random
var = random.randint(0,6)

using randint you will get the numbers you give it (i.e. 0,6 will give all 7 numbers, 0,1,2,3,4,5,6).

Tim
  • 2,563
  • 1
  • 23
  • 31