分类: Python/Ruby
2023-01-11 17:16:17
# 1.开户
def kaihu():
xingming=input("请输入姓名:")
shenfenzheng=input("请输入身份证:")
shoujihao=input("请输入手机号:")
mima=int(input("请输入密码:"))
mima1=int(input('请再次输入密码:'))
while mima!=mima1:
print("密码输入有误!请重新开户!")
mima=int(input("请输入密码:"))
mima1=int(input('请再次输入密码:'))
return mima
def kaihu1():
jine=int(input("请输入预存金额:"))
print(f"存款成功!您的卡号为{suijikahao},短信已发至您的,手机号上,请注意查收!\n")
return jine
kahaomima()
# 合并卡号密码字典
def Merge(kahaomima,zongkahaomima):
ppp = {**kahaomima, **zongkahaomima}
return ppp
# 卡号密码字典
def kahaomima(a):
kahaomima={}
kahaomima[suijikahao]=a
return kahaomima
# 合并卡号金额字典
def Jine(kahaojine,zongkahaojine):
eee = {**kahaojine, **zongkahaojine}
return eee
# 卡号密码字典
def kahaojine(aa):
kahaojine={}
kahaojine[suijikahao]=aa
return kahaojine
# 随机号码
def Suijikahao():
import random
s1=0
s2=0
s3=0
s4=0
s5=0
s6=0
s1=random.randint(0,9)
while s2==s1:
s2=random.randint(0,9)
while s3==s1 or s3==s2:
s3=random.randint(0,9)
while s4==s1 or s4==s2 or s4==s3:
s4=random.randint(0,9)
while s5==s1 or s5==s2 or s5==s3 or s5==s4:
s5=random.randint(0,9)
while s6==s1 or s6==s2 or s6==s3 or s6==s4 or s6==s5:
s6=random.randint(0,9)
if s1==0:
x=s2*100000+s3*10000+s4*1000+s5*100+s6*10
else:
x=s1*100000+s2*10000+s3*1000+s4*100+s5*10+s6
return x
# 2 .查询
def chaxun():
kahao=int(input("请输入您的卡号:"))
if kahao in zongkahaomima:
mima=input("请输入您的密码:")
fansile=str(zongkahaomima[kahao])
jihui=3
huihe=1
while mima!=fansile:
cishu=3-huihe
mima=input(f"密码错误!\n您还有{cishu}次机会,请再次输入密码:")
huihe+=1
if cishu==0:
print("密码错误次数已达三次,正在返回功能界面!")
return 0
print(f"您的账户余额为:{zongkahaojine[kahao]}元\n")
else:
print("你输入的卡号不存在!将返回主界面!")
return 0
# 3.取款
def qukuan():
kahao=int(input("请输入您的卡号:"))
gg=123
if kahao in zongkahaomima:
mima=input("请输入您的密码:")
fansile=str(zongkahaomima[kahao])
jihui=3
huihe=1
while mima!=fansile:
cishu=3-huihe
mima=input(f"密码错误!\n您还有{cishu}次机会,请再次输入密码:")
huihe+=1
if cishu==0:
print("密码错误次数已达三次,正在返回功能界面!")
return gg
return kahao
else:
print("你输入的卡号不存在!将返回主界面!")
return gg
def qukuan1():
qukuan=int(input("密码正确!\n请输入取款金额:"))
global yue
while qukuan>yue:
qukuan=int(input("余额不足!请重新输入取款金额:"))
aaaa=int(zongkahaojine[kahao])
yue=aaaa-qukuan
print(f"取款成功!请留意手机信息!\n您的余额为:{yue}元\n")
return yue
# 4.存款
def cunkuan():
kahao=int(input("请输入您的卡号:"))
gg=123
if kahao in zongkahaomima:
mima=input("请输入您的密码:")
fansile=str(zongkahaomima[kahao])
jihui=3
huihe=1
while mima!=fansile:
cishu=3-huihe
mima=input(f"密码错误!\n您还有{cishu}次机会,请再次输入密码:")
huihe+=1
if cishu==0:
print("密码错误次数已达三次,正在返回功能界面!")
return gg
return kahao
else:
print("你输入的卡号不存在!将返回主界面!")
return gg
def cunkuan1():
cunkuan=int(input("密码正确!\n请输入存款金额:"))
aaaa=int(zongkahaojine[kahao])
yue=aaaa+cunkuan
print(f"存款成功!请留意手机信息!\n您的余额为:{yue}元\n")
return yue
# 5.转账
def zhuanzhang():
kahao=int(input("请输入您的卡号:"))
gg=123
if kahao in zongkahaomima:
mima=input("请输入您的密码:")
fansile=str(zongkahaomima[kahao])
jihui=3
huihe=1
while mima!=fansile:
cishu=3-huihe
mima=input(f"密码错误!\n您还有{cishu}次机会,请再次输入密码:")
huihe+=1
if cishu==0:
print("密码错误次数已达三次,正在返回功能界面!")
return gg
return kahao
else:
print("你输入的卡号不存在!将返回主界面!")
return gg
def zhuanzhang1():
kahao=int(input("请输入您要转账的卡号:"))
gg=123
if kahao in zongkahaomima:
mima=input("请输入您的密码:")
fansile=str(zongkahaomima[kahao])
jihui=3
huihe=1
while mima!=fansile:
cishu=3-huihe
mima=input(f"密码错误!\n您还有{cishu}次机会,请再次输入密码:")
huihe+=1
if cishu==0:
print("密码错误次数已达三次,正在返回功能界面!")
return gg
return kahao
else:
print("你输入的卡号不存在!将返回主界面!")
return gg
def zhuanzhang2():
zhuanzhang=int(input("密码正确!\n请输入转账金额:"))
return zhuanzhang
def zhuanzhang3():
aaaa=int(zongkahaojine[kahao1])
yue=aaaa-zhuan
print(f"转账成功!请留意手机信息!\n您的余额为:{yue}元\n")
return yue
# 主界面
def zhujiemian():
import time
print("正在进入系统,请稍后......")
time.sleep(1)
print("正在进入系统,请稍后......(3)")
time.sleep(1)
print("正在进入系统,请稍后......(2)")
time.sleep(1)
print("正在进入系统,请稍后......(1)")
time.sleep(1)
print("*"*40)
print("*"*40)
print("*** 1.开户 2.查询 ***\n*** *** \n*** 3.取款 4.存款 ***")
print("*** ***\n*** 5.转账 6.锁定 ***\n*** *** \n*** 7.解锁 8.退出 ***")
print("*"*40)
print("*"*40)
#---------------------------------------------------------------------------------
guanliyuanid='admin'
guanliyuanpsw='admin123'
guanliyuanzhanghu=str(input("请输入管理员账户:"))
guanliyuanmima=str(input("请输入密码:"))
while guanliyuanid !=外汇跟单gendan5.com guanliyuanzhanghu or guanliyuanpsw != guanliyuanmima:
guanliyuanzhanghu=input("账号或密码错误!请重新输入!\n请输入管理员账户:")
guanliyuanmima=input("请输入密码:")
print("欢迎登录银行系统")
zhujiemian()
zongkahaomima={}
zongkahaojine={}
a = str()
aa = str()
x=0
while x!=13841354351384354381813543846846438:#不知道输入什么就输入一串神秘代码
x=int(input("请输入你的操作(输入数字1~8):"))
if x==1:
suijikahao=Suijikahao()
a = kaihu()
aa = kaihu1()
Merge(kahaomima(a),zongkahaomima)
zongkahaomima = Merge(kahaomima(a), zongkahaomima)
Jine(kahaojine(aa),zongkahaojine)
zongkahaojine = Jine(kahaojine(aa),zongkahaojine)
yue=aa
if x==2:
chaxun()
if x==3:
kahao = qukuan()
if kahao!=123:
yue = qukuan1()
zongkahaojine[kahao]=yue
if x==4:
kahao = cunkuan()
if kahao!=123:
yue = cunkuan1()
zongkahaojine[kahao]=yue
if x==5:
kahao1 = zhuanzhang()
if kahao1!=123:
zhuan = zhuanzhang2()
kahao2 = zhuanzhang1()
if kahao2!=123:
yue = zhuanzhang3()
zongkahaojine[kahao1]=yue
zongkahaojine[kahao2]=zongkahaojine[kahao2]+zhuan
if x==8:
zhanghu=str(input("请输入账户:"))
mima=str(input("请输入密码:"))
if zhanghu==guanliyuanid and mima==guanliyuanpsw:
print("退出成功!")
break
else:
print("账号或密码错误!将重新加载主界面!")
zhujiemian()