'random' module Flashcards

1
Q

random.random()

A

produces a random number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

random.randrange(x) or (x,y)

A

will produce a random number between 0 and X or between X and Y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

random.sample(x, y)

A

Takes two arguments, a population and an amount. Will return a sample of a population.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

random.choice(x)

A

Takes in a list argument, and returns a random choice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

random.shuffle(x)

A

Takes in a list argument and shuffles the items

How well did you know this?
1
Not at all
2
3
4
5
Perfectly