import random sets=3 for x in range(0, sets): pb1=random.choice([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53]) pb2=random.choice([1-53])
pb3=random.choice([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53]) pb4=random.choice([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53]) pb5=random.choice([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53]) pb6=random.choice([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]) alist = sorted([pb1, pb2, pb3, pb4, pb5]) print ("Your numbers: {} Powerball: {}".format(alist, pb6)) I am trying this example. The program works, but the numbers don't line up if the number of digits are different sizes. http://openbookproject.net/pybiblio/practice/wilson/powerball.php Suggestion please? BTW the exercise instructions say to use the choice function. I assume I had to include all the numbers to choose from instead of picking a random number from 1-53 or 1-42. I included my shortcut for pb2. It doesn't work? Is there a short to prevent from listing each number? -- https://mail.python.org/mailman/listinfo/python-list