银行取款

今天练习的小程序:

#!/usr/bin/env python
#-*- coding:utf-8 -*-
import time
tag=True
while tag:
    name=input('please input your name: ')
    pwd=input('please input your password: ')

    if name == 'connor' and pwd == '123':
        print('login successful')
        while tag:
            print("""
            0 退出
            1 取款
            2 转账
            3 查询
            """)
            choice=input('请输入您要执行的操作:') #choice='1'
            if choice == '0':
                tag=False
            elif choice == '1':
                money=int(input('请输入取款金额:'))
                print('取款中...')
                time.sleep(2)
                print('您的取款金额为%s元,请确认并收好您的钱款'%money)
            elif choice == '2':
                num= int(input('请输入转账账号:'))
                money = int(input('请输入转账金额:'))
                print('转账...')
                time.sleep(2)
                print('您已经成功向账号%s转账%s元' % (num,money))
            elif choice == '3':
                print('查询')
            else:
                print('输入指令错误,请重新输入')
    else:
        print('username or password error')

转载于:https://www.cnblogs.com/luowenConnor/p/10721081.html

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐