Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!