Python 23rd Day-----Job

Source: Internet
Author: User

1 #! Usr/bin/env python2 #-*-coding:utf-8-*-3 #Author Calmyan4 ImportOS, Sys,time5 6  fromCoreImportTransaction#includes all operations related to account amount, such as bookkeeping \ refund/withdrawal, etc.7  fromCoreImportUser_pass#User name detection related8  fromCoreImportLog_file#Log Related9 Ten  One defLogin ():#Start function A     #time_format= '%y-%m-%d%x ' #定义时间格式 -     #times=time.strftime (time_format) #定义时间 -     Print("Welcome to Python ATM". Center (60,'*')) the      whileTrue: -         Print(" "================================================ - 1 >>>> User login. - 2 >>>> exit directly. + ================================================ -         " ") +  AFoo=input ('Please select the action you want:') at         iffoo=='1': -_user_name= User_pass.user_pass ()#assigning a validated user name to a variable -Data=transaction.user_info (_user_name)#Call account Query function -             ifdata['Status']: -                 Print('\033[31;1m Sorry your account is frozen, can not carry out related operation, please contact customer service!\033[0m') -                 Continue in             Print('Dear: \033[32;1m%s\033[0m Welcome to login'. Center (50,'=')%_user_name) -              whileTrue: to                 Print(" "Welcome to Automatic ATM Teller machine + 1 >>> account information enquiry. 2 >>> account transfer. - 3 >>> Cash withdrawal. 4 >>> repayment. the 5 >>> exit. *                 " ") $Options=input ('Please follow the instructions:')Panax Notoginseng                 ifoptions=='1': -                      whileTrue: theTransaction.info_user (_user_name)##调用帐户查询函数用户操作日志, incoming content +                          Break A                 elifoptions=='2': theData=transaction.user_info (_user_name)#Call account Query function +                     Print(Transaction.info_format (data))#user Information output Format function -                     Print('Welcome to Self-service transfer'. Center (60,'=')) $Card=input ('Press \033[31;1mq/q\033[0m to return the card number entered:') $                     ifcard=='Q' orcard=='Q': -                         Continue -                     ifCard.isdigit ():#detects whether the input is an integer theCard=int (Card)#Convert to int -                         ifcard==data['ID']:Wuyi                             Print('\033[41;1m you entered the card number is your own card number, please re-enter!\033[0m') theTransaction.transfer (Card,_user_name)##调用转帐的函数 -                         Continue Wu                     Else: -                         Print('your input is not correct, please re-enter!') About                         Pass $  -  -                 elifoptions=='3': -                      whileTrue: AData=transaction.user_info (_user_name)#Call account Query function +                         Print(Transaction.info_format (data))#user Information output Format function theMony=input ('Press \033[31;1mq/q\033[0m to return please enter the amount you wish to withdraw:') -                         ifmony=='Q' ormony=='Q': $                              Break the                         ifMony.isdigit ():#detects whether the input is an integer theMony=int (Mony)#Convert to int theTransaction.cash (Mony,_user_name)##调用取现的函数 the                             Continue -                         Else: in                             Print('your input is not correct, please re-enter!') the                             Pass the                 elifoptions=='4': About                      whileTrue: theData=transaction.user_info (_user_name)#Call account Query function the                         Print(Transaction.info_format (data))#user Information output Format function thes_mony=data["Maximum amount"]-data["Account Credit Balance"] +                         Print('the total need to repay this issue: to \033[31;1m%s\033[0m'%s_mony) -Mony=input ('Press \033[31;1mq/q\033[0m to return, enter the amount you want to repay:') the                         ifmony=='Q' ormony=='Q':Bayi                              Break the                         ifMony.isdigit ():#detects whether the input is an integer theMony=int (Mony)#Convert to int -Transaction.also_money (Mony,s_mony,_user_name,data)#repayment function -                             Pass the                         Else: the                             Print('your input is not correct, please re-enter!') the                             Pass the  -                 elifoptions=='5': the exit () the                 Else: the                     Continue94  the         eliffoo=='2': the exit () the         Else:98             Print('Please follow the instructions!') About             Pass
View Code

Python 23rd Day-----Job

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.