t399.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import random
  2. random.seed(0)
  3. print "randint"
  4. print random.randint(4, 9)
  5. print random.randint(4, 9)
  6. print random.randint(4, 9)
  7. print random.randint(4, 9)
  8. print random.randint(4, 9)
  9. print random.randint(4, 9)
  10. print "randrange"
  11. print random.randrange(4, 9)
  12. print random.randrange(4, 9)
  13. print random.randrange(4, 9)
  14. print random.randrange(4, 9)
  15. print random.randrange(4, 9)
  16. print random.randrange(4, 9)
  17. print "step -2"
  18. print random.randrange(8, -4, -2)
  19. print random.randrange(8, -4, -2)
  20. print random.randrange(8, -4, -2)
  21. print random.randrange(8, -4, -2)
  22. print random.randrange(8, -4, -2)
  23. print random.randrange(8, -4, -2)
  24. print random.randrange(8, -4, -2)
  25. print random.randrange(8, -4, -2)
  26. print "step 3"
  27. print random.randrange(5, 15, 3)
  28. print random.randrange(5, 15, 3)
  29. print random.randrange(5, 15, 3)
  30. print random.randrange(5, 15, 3)
  31. print random.randrange(5, 15, 3)
  32. print random.randrange(5, 15, 3)
  33. print random.randrange(5, 15, 3)
  34. print random.randrange(5, 15, 3)
  35. print "list"
  36. l = range(9)
  37. print random.choice(l)
  38. random.shuffle(l)
  39. print l
  40. print random.choice(l)
  41. random.shuffle(l)
  42. print l
  43. print random.choice(l)
  44. random.shuffle(l)
  45. print l
  46. print random.choice(l)
  47. random.shuffle(l)
  48. print l
  49. print random.choice(l)
  50. random.shuffle(l)
  51. print l
  52. print random.choice(l)
  53. random.shuffle(l)
  54. print l
  55. print random.choice(l)
  56. random.shuffle(l)
  57. print l
  58. print random.choice(l)
  59. random.shuffle(l)
  60. print l
  61. print random.choice(l)
  62. random.shuffle(l)
  63. print l