1 Star 0 Fork 0

Shero / 第一周作业

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
3.py 2.03 KB
Copy Edit Web IDE Raw Blame History
Shero authored 2018-10-20 23:06 . Upload 3.py
print("====CSDN自动取款机====")
#账户信息
user_data = {
'Alice': {'password': 'aaa', 'account': 5000},
'Black': {'password': 'bbb', 'account': 10000},
'Cindy': {'password': 'ccc', 'account': 15000},
}
#用户界面
while True:
print('='*12, '欢迎使用ATM系统', '='*12)
print("请登录:")
user = input("请输入您的账号:")
if user in user_data:
passwd = input("请输入密码:")
if passwd == user_data[user]['password']:
while True:
print('{0:1} {1:10} {2:10}'.format(' ', '1. 余额', '2. 取钱'))
print('{0:1} {1:10} {2:10}'.format(' ', '3. 存钱', '4. 退出'))
key = input("请选择您要进行的业务:")
if key == '1':
print('您的余额为:' + str(user_data[user]['account']))
elif key == '2':
saves = input('要取多少钱:')
if int(saves) > int(user_data[user]['account']):
print("余额不足!")
else:
saves = int(user_data[user]['account']) - int(saves)
del user_data[user]['account']
user_data[user]['account'] = saves
print('取款成功,现在余额为:' + str(user_data[user]['account']))
elif key == '3':
saves = input('要存多少钱:')
saves = int(saves) + int(user_data[user]['account'])
del user_data[user]['account']
user_data[user]['account'] = saves
print('存入成功,现在余额为:' + str(user_data[user]['account']))
elif key == '4':
print('欢迎下次光临!')
break
else:
print('输入有误,请重新选择!')
else:
print('密码错误!')
else:
print('账户不存在!')

Comment ( 0 )

Sign in for post a comment

Python
1
https://gitee.com/Chan_Shero/first_week_assignment.git
git@gitee.com:Chan_Shero/first_week_assignment.git
Chan_Shero
first_week_assignment
第一周作业
master

Search