I am trying to write a blackjack code in python 2.7 and can't figure out how to sum my c1 and c2 once an output is given. This is what I have so far:
def blackjackTips(c1,c2):
print "Welcome to Blackjack!"
print "Your cards are", name[c1-1],"&",name[c2-1]
total= sum ([c1]+[c2])
print "Your card total is",total
name = ('A','2','3','4','5','6','7','8','9','10','J','Q','K')
value = (11,2,3,4,5,6,7,8,9,10,10,10,10)
output:
>>> blackjackTips(11,6)
Welcome to Blackjack!
Your cards are J & 6
Your card total is 17
*The current syntax return the wrong sum is being calculated. The sum should be 16.
Could someone please provide guidance?
Thank you
You need:
total = value[c1-1]+value[c2-1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With