python----随机生成100个卡号

版权声明:https://blog.csdn.net/weixin_42499593 https://blog.csdn.net/weixin_42499593/article/details/89222273

题目:
#1. 随机生成100个卡号;
#卡号以6102009开头, 后面3位依次是 (001, 002, 003, 100),
#2. 生成关于银行卡号的字典, 默认每个卡号的初始密码为"redhat";

#3. 输出卡号和密码信息, 格式如下:
卡号 密码
6102009001 000000

Card_List = []
for i in range(100):
    str = ('6102009' + '%.3d' %(i+1))
    Card_List.append(str)

Card_Dict = {}.fromkeys(Card_List,'redhat')
print('卡号       密码')
for k,v in Card_Dict.items():
    print(k,v)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42499593/article/details/89222273