import itertools if __name__ == '__main__': date = input("出生日期: ") sex = '02468' if int(input("性别(男1女2): ")) % 2 == 0 else '13579' # 性别位 check = '0123456789X' # 校验位 other = '0123456789' # 其它位 nums = itertools.product(other, other, sex, check) cards = [] for num in nums: card = date + "".join(num) cards.append(card) print(len(cards)) print(cards)
|