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

2

1 Answer 1

5

You can use random.choice:

print(random.choice([1, 3, 4, 5, 6, 7, 8, 9, 10])) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.