-2
card_value = 'J':11

print(card_value(x),'ack')
print(card_value(y)-11)

Basically I am making poker and don’t know how to deal with the J-Ace having their own numbers , while using the value to figure out types of hands.

Jed Fox
  • 2,979
  • 5
  • 28
  • 38
  • you want to create string "J-11" with string var "J" and int var "11" ? – dikkini Dec 09 '16 at 16:43
  • 2
    perhaps a dictionary like `{'J':11}` – Chris_Rands Dec 09 '16 at 16:44
  • take a look at the basic data structures of Python – MMF Dec 09 '16 at 16:46
  • Strings are for humans. Computers do things with numbers. Represent card values (and even suits) as just plain numbers, perhaps 2=2, 3=3,...11=J, 12=Q, etc. And maybe 1=clubs, 2=diamonds, etc. Then do all the coding with numbers, and only translate them to strings for display to a human. – Lee Daniel Crocker Dec 10 '16 at 00:38

1 Answers1

1

Use a dictionary :

my_dict = {'J':11, 'A':10}

Then you can retrieve the value :

>> my_dict['J']
>> 11
MMF
  • 5,750
  • 3
  • 16
  • 20