Building lottery numbers – Python

Lottery number:

This software selecting 6 random numbers between 1-37, the number can not go back twice

Used: import random , for


To copy or see all commands you can click on Details button below



author: Hopeless
task: lottery number , number can not return twice
import random
#all numbers = range (1,37)
allnumbers = range(1,38)
winningNums = []

for i in range(1,7):
num = allnumbers[random.randrange(0,len(allnumbers))]

print winningNums





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s