To make a list internal string recognized as one

Asked 2 years ago, Updated 2 years ago, 17 views

Card 45=[]
L=['◇3', '♠1', '♠11', '♠8', '♣2']

if L[1][0]==L[2][0] and L[1][1]!=L[2][1]:
    print("fff")
    Card 45.append (L.pop (1))
    Card 45.append (L.pop (1))

print (card 45)

I'm going to put two cards with the same pattern and different numbers on the list of card 45. When the list L was randomly generated and rotated, even if it was the same code, there were times when it was successful and sometimes it failed, so I wrote down the code again and looked for the reason. When I printed L[2][1], I got 1 instead of 11, so I had a problem whenever the decimal places were the same. What should we do in this case?

python

2022-09-20 19:33

1 Answers

The first method

The second way

The third way


2022-09-20 19:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.