[Tutor] Is there a qucker method than the following?

Nathan Pinno falcon3166 at hotmail.com
Fri Aug 5 21:43:25 CEST 2005


Hi all,

Is there a quicker method than the following?

import random
numbers = [0,1,2,3,4,5,6,7,8,9,10,11,12]
cards = ["Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"]
hand = {numbers:cards}

def menu():
    print "1. Deal a hand"
    print "2. Exit"

def option():
    return int(raw_input("Option: "))

def deal():
    a,b,c,d,e = random.choice(13)

print "The Five Card Dealer"
print "By Nathan Pinno"
while 1:
    menu()
    opt = option()
    while opt == 1:
        if a == 1:
            a = hand[0]
        if a == 2:
            a = hand[1]
        etc..
    while opt == 2:
            break
print "Goodbye."

Thanks,
Nathan Pinno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050805/650b3cc7/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pinno, Nathan Paul.vcf
Type: text/x-vcard
Size: 783 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20050805/650b3cc7/PinnoNathanPaul.vcf


More information about the Tutor mailing list