generate a random number between 1 and 10 in python

To generate a random integer between 1 and 10 in Python, you can use the random module's randint function, which takes two arguments: the lowest and highest numbers in the range.

Here's an example code snippet:

main.py
import random

random_number = random.randint(1, 10)
print(random_number)
74 chars
5 lines

In this example, we import the random module, generate a random integer between 1 and 10 using randint, and print the result.

gistlibby LogSnag