0

how do I join these 2 list

suits = ['C','D','H','S']

and

value = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']

to A-C, 2-C and so forth until K-S?

i tried doing these format but it didn't work

def options():
    i = 13
    option1 = []
    while True:
      option = input()
      suits = ['C','D','H','S']
      value = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
      cards = str
      _input = int(input())
      suit = suits[_input-1]
      for j in value:
       option1 = print(j+"-"+suit+",", end="")  
      return option1
  • `from itertools import product; list(map(lambda x: "-".join(x), product(value, suits)))` – ThePyGuy Nov 05 '22 at 11:15
  • What you call `value` is generally referred to as the *ranks* of the cards. So I would rename `value` to `ranks` and then: `deck = [f'{rank}-{suit}' for suit in suits for rank in ranks]`, which produces a list such as `['A-C', '2-C`, ... 'K-S']`. – Booboo Nov 05 '22 at 11:27

1 Answers1

0

already answered it i did this instead '''suits = ['C','D','H','S'] value = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'] for i in suits: for j in value: cards = print(j+"-"+i, end=",")'''