0

I want to print random number using python. if I use random.randint(1, 10) it would give me random number from 1-10. what if I want to print random number between 1-10 but number 2 is not include? thankyou

Lalayeye
  • 3
  • 2
  • Does this answer your question? [Generate 'n' unique random numbers within a range](https://stackoverflow.com/questions/22842289/generate-n-unique-random-numbers-within-a-range) – Hearner Nov 22 '20 at 13:43
  • Does this answers: https://stackoverflow.com/questions/29804599/python-random-number-excluding-one-variable – Manika Sharma Nov 22 '20 at 13:49

1 Answers1

5

You can use random.choice:

print(random.choice([1, 3, 4, 5, 6, 7, 8, 9, 10]))
James
  • 32,991
  • 4
  • 47
  • 70