Oct 282010
Generate a random number in Python
Answer:
It is very easy to generate a random number in Python, see below:
import random
print random.randint(1,100)
The above code print a number between 1 to 100.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Generate a random number in Python
Answer:
It is very easy to generate a random number in Python, see below:
import random
print random.randint(1,100)
The above code print a number between 1 to 100.