题目知识点写着:字符串、链表、队列、栈
实际上程序中并没体现链表、队列、栈。当然了如果你认为list是这三,必然是包含了。
1 ''' 2 测试输入 3 3 4 5 6 7-10 J Q K A 4 输出 5 10 J Q K A 6 ''' 7 l=input().split('-') 8 l1=l[0].split() 9 l2=l[1].split() 10 flag=0 11 if len(l1)!=len(l2): 12 #根据牌数量判断两手牌是否存在比较关系 13 if len(l1)==4 or len(l2)==4 or 'JOKER' in l1 or 'joker' in l2: 14 pass 15 else: 16 flag=1 17 print ("ERROR") 18 poker=['3','4','5','6','7','8','9','10','J','Q','K','A','2','joker','JOKER'] 19 if flag==0: 20 #print(l1,l2) 21 if 'JOKER' in l1 : 22 out=l1 23 elif 'JOKER' in l2: 24 out=l2 25 elif len(l1)!=len(l2): 26 if len(l1)==4: 27 out=l1 28 else: 29 out=l2 30 elif len(l1)==5: 31 temp1,temp2=[],[] 32 for i in l1: 33 temp1.append(poker.index(i)) 34 for i in l2: 35 temp2.append(poker.index(i)) 36 temp1.sort() 37 temp2.sort() 38 if temp1[0]<temp2[0]: 39 out=l2 40 else: 41 out=l1 42 elif len(l1)==len(l2): #对比较牌面大小的牌比较 43 if poker.index(l1[0])>poker.index(l2[0]): 44 out=l1 45 else: 46 out=l2 47 print(" ".join(out))
标签:poker,扑克牌,len,temp1,l2,HJ88,l1,大小,out From: https://www.cnblogs.com/tanyuanqing/p/17368877.html