jeudi 8 décembre 2016

how can i change my code so that jack, queen etc will add 10 to my total

#pontoon

import random

total = (0)

Ace = (10)

Jack = (10)

Queen = (10)

King = (10)


suits = ['Hearts','Clubs','Diamonds','Spades']#list of suits
cards = ['Ace','2','3','4','5','6','7','8','9','10','Jack','Queen','king']#list of cards

print('The rules:\nYou need to get the sum of your cards as close to 21 as possible.\nAces, Jacks, Queens and Kings are all equal to 10.\nStick means that you dont want to recieve anymore cards.\nBust means that the sum of your cards has exceeded 21 so you automatically lose.\nTwist means you want another card.')
input()

random.choice (suits)
random.choice (cards)
print (random.choice (cards)+ ' of ' +random.choice (suits))#this shows a random card
print (random.choice (cards)+ ' of ' +random.choice (suits))

if cards == (Jack):
    total =+ (Jack)

elif cards == (Queen):
    total =+ (Queen)

elif cards == (King):
    total =+ (King)

elif cards == (Ace):
    total =+ (Ace)

elif cards == 2:
    total =+ (int('2'))

elif cards == 3:
    total =+ (int('3'))

elif (cards) == ('4'):
    total =+ (int('4'))

elif (cards) == ('5'):
    total =+ (int('5'))

elif (cards) == ('6'):
    total =+ (int('6'))

elif (cards) == ('7'):
    total =+ (int('7'))

elif (cards) == ('8'):
    total =+ (int('8'))

elif cards == 9:
    total =+ (int('9'))




print ('\nyour total is...')
print (total)




Aucun commentaire:

Enregistrer un commentaire