Randomly generated bank card number, card number and password information output
Topics requirements:
- 100 randomly generated card;
card beginning 6,102,009, followed by three back (001, 002, 003, 100), - Dictionary generated on bank card number, the initial default password for each card number is "redhat";
- Output card number and password information in the following format:
卡号 密码
6102009001 000000
code show as below:
card_ids = []
# 生成100个卡号
for i in range(100):
# %.3d:代表整数的占位
s = '6102009%.3d' %(i+1)
card_ids.append(s)
card_ids_dict = {}.fromkeys(card_ids,'redhat')
print(card_ids_dict)
print('卡号\t\t\t\t\t密码')
for key in card_ids_dict:
print('%s\t\t\t%s' %(key,card_ids_dict[key]))
Output:
Generated a total of 100 results