题解 | #扑克牌大小#打牌还是不难

扑克牌大小

http://www.nowcoder.com/practice/d290db02bacc4c40965ac31d16b1c3eb

while True:

try:
    card_dict = {
        '1': 1,
        '3': 3,
        '4': 4,
        '5': 5,
        '6': 6,
        '7': 7,
        '8': 8,
        '9': 9,
        '10': 10,
        'J': 11,
        'Q': 12,
        'K': 13,
        'A': 14,
        '2': 15,
        'joker': 16,
        'JOKER': 17
    }
    first_card, second_card = input().split('-')
    first_num = len(first_card.split())
    second_num = len(second_card.split())
    
    if 'JOKER' in first_card:
        print(first_card)
    elif 'JOKER' in second_card:
        print(second_card)
    elif first_num != second_num and first_num != 4 and second_num != 4:
        print('ERROR')
    elif first_num != second_num:
        if first_num == 4:
            print(first_card)
        elif second_num == 4:
            print(second_card)
    elif first_num == second_num:
        if card_dict[first_card.split()[0]] > card_dict[second_card.split()[0]]:
            print(first_card)
        else:
            print(second_card)
        
except:
    break
全部评论

相关推荐

10-13 17:47
门头沟学院 Java
wulala.god:图一那个善我面过,老板网上找的题库面的
点赞 评论 收藏
分享
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务