资源简介
ATM 取款(python入门级示例)
代码片段和文件信息
import random
display=‘‘‘
**********************
* *
* welcome to bank *
* *
**********************
‘‘‘
display2=‘‘‘
**********************
* 1.登陆 2.开户 *
* 3.查询 4.取款 *
* 5.存款 6.退出 *
**********************
‘‘‘
def getkamun(userdict):
userlist = list(userdict)
kanum = userdict.keys()
while 1:
kalist =[]
while len(kalist)<3:
i = random.randrange(10)
if str(i) not in kalist:
kalist.append(str(i))
kanum=““.join(kalist)
if kanum in userlist:
continue
else:
break
return kanum
def register(userdict):
idcard =input(“身份证号:“)
name = input(“用户名:“)
phone =input(“电话号码:“)
money=int(input(“预存款:“))
while 1:
psd1 =input(“密码:“)
psd2 =input(“确认密码:“)
if psd1==psd2:
psd=psd2
break
else:
print(“密码不一致,
评论
共有 条评论