# 写函数,返回一个扑克牌列表,里面有52项,每一项是一个元组,例如:[(‘红心’,2),(‘草花’,2), …(‘黑桃A’)]
def card_f(): card_lst = [] num_temp = [] for i in range(2,11): num_temp.append(i) num_temp.extend(['A','J','Q','K']) for num in num_temp: for color in ['红桃','方块','黑桃','梅花']: card_lst.append((color,num)) return card_lst ret = card_f() print(ret)