Advertisement
Guest User

Untitled

a guest
May 25th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. """
  2. Python’s random module includes a function choice(data) that returns a
  3. random element from a non-empty sequence. The random module in-
  4. cludes a more basic function randrange, with parameterization similar to
  5. the built-in range function, that return a random choice from the given
  6. range. Using only the randrange function, implement your own version
  7. of the choice function.
  8. """
  9. from random import randrange
  10.  
  11. def gimme_number():
  12. return randrange(5, 26, 5)
  13. # would do the same as choice(5, 10, 15, 20, 25)
  14.  
  15. print(gimme_number())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement