Python 小案例实战 —— 简易银行存取款查询系统
涉及知识点
包的调用
字典、列表的混合运用
列表元素索引、追加
基本的循环与分支结构
源码
import sys
import time
bank = {
'users':['Tom','Jack'],
'pwd': ['1701', '1702'],
'money':[1000,2000],
'history':[[],[]]
}
while True:
user_now_name = str(input("欢迎使用本系统!请输入您的用户名:\n"))
if user_now_name in bank['users']:
user_index = bank['users'].index(user_now_name)
# print('尊敬的', user_now_name, '您好!')
while True:
user_now_pwd = str(input("请输入您的密码:\n"))
if user_now_pwd == bank['pwd'][user_index]:
print('登录成功!')
isLogin = True
bank['history'][user_index].a