Unfortunately as I overly enjoy writing scripts, I tend to spoil the recipients of the tutor.
IF!!!! you do not wish to have a complete answer, read someone else's email and not mine.
 
### Start code###
import random
 
participants = 10
ask = [raw_input('What is the participant\'s name? ') for x in range(participants)]
 
for x in range(52):
    a = range(1,100)
 
    people = {}
    for i in ask:
        randomnum = random.choice(a)
        a.remove(randomnum)  ## This is to keep from giving two people the same number
        people[i] = randomnum
   
    ##realnum = random.randint(1,100)         ## Uncomment this to choose between 1&99 regardless of people
    realnum = random.choice(people.values())  ## Uncomment this to make sure someone wins. (default)
 

    ## Check -- did anyone win?
 

    for x,y in people.items():
        if y == realnum:
            print "%s just won the lottery! Congratulations! " % x
    raw_input("Press enter to run next week's lottery. ")
HTH and that I don't over help someone,
Jacob Schmidt

 

I am new to python and only created very simple programs so far.I would like to simulate a lottery draw for 10 participants and run it for 52 weeks. The lottery numbers would have a range of 1 to 99. Each person would have just one number (random) and play for 52 weeks.

 

Are there any starting ideas for me to get going on this project either thru the tutor or searching for snippets already created by fellow programmers??

 

Thanks a lot in advance for all the help,

 

Regards,

 

 

**********************************************

Ümit N Tezcan

SEYAŞ- European Projects Coordinator

Tel   : +90-212-2330920 (Ext.153)

Fax  : +90-212-233-0936

Mob : +90-533-337-7352

E-mail: [EMAIL PROTECTED]

www : seyas.com.tr

**********************************************

This email/fax message is for the sole use of the intended recipient(s) and may contain confidential and privileged information, or trade secrets.  Any unauthorized review, use, disclosure or distribution of this email/fax is prohibited.  If you are not the intended recipient, please contact the sender by email/fax and destroy all paper and electronic copies of the original message.

 

 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to