Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inscribedCustomers = {}
- class Customers(dict):
- def __init__(self, name, password, balance):
- self.name = name
- self.password = password
- self.balance = balance
- def tell(self):
- return self.name
- def tell_password(self):
- return self.password
- def tell_balance(self):
- return self.balance
- def add(person):
- inscribedCustomers[person.tell()] = [person.tell_password(), person.tell_balance()]
- def delete(person):
- del inscribedCustomers[person]
- def check_balance():
- check_name = str(raw_input('\nName: '))
- if check_name in inscribedCustomers:
- print "\nWelcome %s it's good to see you again" % check_name
- check_password = str(raw_input('\nEnter password: '))
- if check_password in inscribedCustomers[check_name]:
- print '\nYour balance is %s.\n' % inscribedCustomers[check_name][1]
- def register():
- enter_name = raw_input('\nEnter name: ')
- enter_password = raw_input('\nEnter password: ')
- reenter_password = raw_input('Reenter password: ')
- if enter_password == reenter_password:
- input_balance = int(raw_input("\nEnter how much you'd like to deposit (USD): "))
- print '\n'
- result = Customers(enter_name, reenter_password, input_balance)
- add(result)
- else:
- print "%s your passwords must match in order to register." % enter_name
- return
- def main():
- print 'Welcome to Trusty SP. ' \
- 'We desire to make your banking easier.' \
- input_main = raw_input('What would you like to do?\n\n'
- '1. Register\n'
- '2. Check Balance\n'
- '3. Delete Account\n\n'
- 'Enter Choice: ')
- if input_main == '1' or input_main == 'Register' or input_main == 'register':
- register()
- main()
- elif input_main == '2' or input_main == 'Check Balance' or input_main == 'check balance':
- check_balance()
- main()
- elif input_main == '3' or input_main == 'Delete Account' or input_main == 'delete account':
- delete_name = raw_input('\nName: ')
- if delete_name in inscribedCustomers:
- delete_password = raw_input('Password: ')
- if delete_password in inscribedCustomers[delete_name]:
- print '\n%s your account will be delete and your funds of %d will be returned.\n' \
- % (delete_name, inscribedCustomers[delete_name][1])
- assure_delete = raw_input("Are you sure you want to delete?\n"
- "\n1. Yes"
- "\n2. No, I changed my mind."
- "\n>> ")
- if assure_delete == '1' or assure_delete == 'Yes':
- delete(delete_name)
- main()
- elif assure_delete == '2' or assure_delete == 'No':
- print '\nReturning to main screen.\n\n'
- main()
- else:
- print 'We would appreciate your comments, please write below.\n'
- comments = raw_input('Comments: \n')
- for i in comments:
- if i == 'I':
- reply = comments.replace('I', 'Master Chief')
- print reply
- print '\nYou done messed up A-Aron.'
- if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print 'Returning...'
- main()
- except ValueError:
- print 'Invalid entry'
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement