题解 | #扑克牌大小#

扑克牌大小

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

player1, player2 = input().split('-')
card_values = {
    '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
}
player11, player22 = list(player1.split(' ')), list(player2.split(' '))

if len(player11) == len(player22):
    if card_values[player11[0]] < card_values[player22[0]]:
        print(player2)
    else:
        print(player1)
else:
    if "joker" in player11 or "JOKER" in player11 or "joker" in player22 or "JOKER" in player22:
        print( 'joker JOKER')
    else:
        if len(player11) == 4 or len(player22)==4 :
            if player11[0] == player11[1] == player11[2] == player11[3]:
                print(player1)
            elif player22[0] == player22[1] == player22[2] == player22[3]:
                print(player2)
        else:
            print('ERROR')

全部评论

相关推荐

服从性笔试吗,发这么多笔,现在还在发。
蟑螂恶霸zZ:傻 x 公司,发两次笔试,两次部门匹配挂,
投递金山WPS等公司10个岗位 >
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务