Powerball Lotto

This is the place for queries that don't fit in any of the other categories.

Powerball Lotto

Postby AdamLandau » Mon Nov 25, 2013 8:57 pm

I seem to be getting errors, anyone fill me in?
Code: Select all
from random import randint
def BubbleSort(l):
    e=0
    for i in range(len(l)-1):
        for j in range(len(l)-1):
            if l[j]>l[j+1]:
                e=l[j+1]
                l[j+1]=l[j]
                l[j]=e
    return l
def MyPrint(L,pb):
        BubbleSort(L)
        print "Your numbers: %d %d %d %d %d Powerball: %d"%(L[0],L[1],L[2],L[3],L[4],pb)

print "Powerball number generator"
No=int(raw_input("How many sets of numbers? "))
for i in range(No):
    numbers=[]
    powerball=randint(1,42)
    i=0
    while (i!=5):
        numbers.append(randint(1,53))
        i+=1
    for i in range(len(numbers)-1):
        for j in range(len(numbers)-1):
            if i==j:
                j+=1
            if numbers[i]==numbers[j] or powerball==numbers[j]:
                numbers[j]=randint(1,53)
                j-=1
    MyPrint(numbers,powerball)
PC Specs:

i5 4670K @ 4.1Ghz
8GB Corsair Vengance RAM
Gigabyte Z87-HD3
1TB S-ATAIII 6.0Gb/s
NVIDIA GeForce GTX 760 2GB
Zalman Z11 Case
Corsair 550W PSU
AdamLandau
 
Posts: 8
Joined: Sat Nov 16, 2013 12:48 pm

Re: Powerball Lotto

Postby stranac » Mon Nov 25, 2013 8:58 pm

AdamLandau wrote:I seem to be getting errors, anyone fill me in?

What kind of errors?
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1143
Joined: Thu Feb 07, 2013 3:42 pm

Re: Powerball Lotto

Postby AdamLandau » Mon Nov 25, 2013 9:33 pm

stranac wrote:
AdamLandau wrote:I seem to be getting errors, anyone fill me in?

What kind of errors?

Fixed thanks!
PC Specs:

i5 4670K @ 4.1Ghz
8GB Corsair Vengance RAM
Gigabyte Z87-HD3
1TB S-ATAIII 6.0Gb/s
NVIDIA GeForce GTX 760 2GB
Zalman Z11 Case
Corsair 550W PSU
AdamLandau
 
Posts: 8
Joined: Sat Nov 16, 2013 12:48 pm


Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot], Yoriz and 1 guest