Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Database.csv has been removed from the assignment so that portion is no longer needed. An updated version of the instructions is posted below. This assignment

Database.csv has been removed from the assignment so that portion is no longer needed. An updated version of the instructions is posted below.

This assignment Involves coding the attached Simple Bank Flowchart. Translate the flow chart to code in python code. I have included a template file needed to get started.

Create a Project in Pycharm called SimpleBank . Download the attachedsimplebank.pyand copy to the project folder.

Code the incomplete functions to translate the flow chart to complete code. You can add functions to thesimplebank.pyfile to make it work per expectation. Use the data in the Python File (The dictionary of users) to validate user.

Do not hard code password verification in thesimplebank.pyfile.

import random

QUIT = '4'

COMMANDS = ('1', '2', '3', '4')

MENU = \"\"\"

Welcome to Simple Bank. Select a Choice to Continue..

1 Login to Your Account

2 Reset Password

3 Log out

4 Quit the program\"\"\"

defacceptCommand():

\"\"\"Inputs and returns a legitimate command number.\"\"\"

while True:

command = input(\"Enter a number: \")

if not command in COMMANDS:

print(\"Error: command not recognized\")

else:

return command

#dictionary of users

users = {

'jdoe': {

'password':'BFtUg0hmYn!E',

'temporary': True

},

'mdoe': {

'password':'AQ#ovGS9JLa6',

'temporary': True

},

'bdoe': {

'password':'T7uxgDsu7L&a',

'temporary': True

},

'tdoe': {

'password':'E4TWO!ac7ey4',

'temporary': False

}

}

defmain():

while True:

print(MENU)

command = acceptCommand()

runCommand(command)

if command == QUIT:

print(\"Have a nice day!\")

break

defrunCommand(command):

\"\"\"Selects and runs a command.\"\"\"

if command == '1':

accountLogin()

elif command == '2':

resetPassword()

elif command == '3':

accountLogOut()

defaccountLogin():

attempts = 0

while True:

attempts+=1

#get username and password

userName = input(\"Enter username: \")

passWord = input(\"Enter password: \")

#Validate User

if validateUser(userName, passWord) == True:

print('Welcome to Simple Bank.')

break

if attempts >= 3:

break

defvalidateUser(userName, passWord):

#Is password Temp?

#If Yes => Ask User to update password then take the user to login

#update users dictionary

#if password is OK

#return True

return False

defresetPassword():

#get username

#generate new password

newPassword = genarateNewPassword()

print('Your New password is %s' % newPassword)

pass

defaccountLogOut():

pass

defgenarateNewPassword():

'''

This function returns a random 10 character password.

'''

alphabet = 'abcdefghijklmnopqrstuvwxyz'

password = ''

for _ in range(10):

r = random.randint(0, 25)

password = password + ( alphabet[r].upper() if r % 2 == 0 else alphabet[r] )

return password

defupdateDataBase(userName, password):

users[userName]['password'] = password

#Program Entry Point

if __name__ == \"__main__\":

main()





Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

m Have you chosen the most effective organizational plan?

Answered: 1 week ago