Given the input
Guess='1 5K'
and a list
playable=['AC','QS','5S','5K','KC']
How would I go about determining if the '5K' part of Guess is in playable? Also, if it is in playable, how would I go about determining if the item 1 spot to the left of it has either a '5' or a 'K' in it. So playable would become
playable=['AC','QS','5K','KC']
With '5K' replacing '5S'. So far I have
def oneC(Guess):
split_em=Guess.split() ##splits at space
card_guess=split_em[1] ##gets the '5K' part of string
if card_guess is in playable:
##Confusion Area
index1=playable.index(card_guess) ##Finds index of '5K'
index_delete= del playable[index1-1] ##Deletes item to the left of '5K'
My problem right now is i'm not sure how to determine if '5' or 'K' is in the item one spot to the left. Is there a way to turn '5K' into a set of ('5','K') and then turn the element one spot to the left to ('5','S') and run intersection on them? I wrote this on my phone because my internet is down at my house so sorry for any confusion or misspellings. Thanks for your time!