Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Python’s random module includes a function choice(data) that returns a
- random element from a non-empty sequence. The random module in-
- cludes a more basic function randrange, with parameterization similar to
- the built-in range function, that return a random choice from the given
- range. Using only the randrange function, implement your own version
- of the choice function.
- """
- from random import randrange
- def gimme_number():
- return randrange(5, 26, 5)
- # would do the same as choice(5, 10, 15, 20, 25)
- print(gimme_number())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement