Without dwelling too deep into your code there are a few alternatives. After a very quick google search, I stumbled upon this question on SO question on SO.
They propose two different solutions.
import random
print random.sample(xrange(1, 10), 3)
This will create three distinct numbers with values ranging from 1 to 9. If you do not want the three numbers to be different, you could try the following
import random
print [random.randrange(1,10) for _ in range(3)]
Without dwelling too deep into your code there are a few alternatives. After a very quick google search, I stumbled upon this question on SO.
They propose two different solutions.
import random
print random.sample(xrange(1, 10), 3)
This will create three distinct numbers with values ranging from 1 to 9. If you do not want the three numbers to be different, you could try the following
import random
print [random.randrange(1,10) for _ in range(3)]
Without dwelling too deep into your code there are a few alternatives. After a very quick google search, I stumbled upon this question on SO.
They propose two different solutions.
import random
print random.sample(xrange(1, 10), 3)
This will create three distinct numbers with values ranging from 1 to 9. If you do not want the three numbers to be different, you could try the following
import random
print [random.randrange(1,10) for _ in range(3)]
Without dwelling too deep into your code there are a few alternatives. After a very quick google search, I stumbled upon this question on SO.
They propose two different solutions.
import random
print random.sample(xrange(1, 10), 3)
This will create three distinct numbers with values ranging from 1 to 9. If you do not want the three numbers to be different, you could try the following
import random
print [random.randrange(1,10) for _ in range(3)]