three random numbers from 6081 in python

To generate three random numbers between 1 and 6081 (inclusive), you can use the randint function provided by the random module. Here's an example:

main.py
import random

# Generate three random numbers between 1 and 6081 (inclusive)
random_numbers = [random.randint(1, 6081) for _ in range(3)]
print(random_numbers)
161 chars
6 lines

Alternatively, you can also use the sample function from the random module to randomly select three unique numbers from a list containing all numbers between 1 and 6081. Here's an example:

main.py
import random

# Create a list of all numbers between 1 and 6081
all_numbers = list(range(1, 6082))

# Randomly select three unique numbers from the list
random_numbers = random.sample(all_numbers, 3)
print(random_numbers)
223 chars
9 lines

Both methods above should produce an output similar to this:

main.py
[3482, 5121, 2045]
19 chars
2 lines

gistlibby LogSnag