Question: python! def import_and_create_accounts(filename): ''' This function is used to create an user accounts dictionary and another login dictionary. The given argument is the filename to

python!

def import_and_create_accounts(filename): ''' This function is used to create an user accounts dictionary and another login dictionary. The given argument is the filename to load. Every line in the file will look like username - password

If the username and password fulfills the requirement, add the username and password into the user accounts dictionary. To make sure that the password fulfills these requirements, be sure to use the signup function that you wrote above. For the login dictionary, the key is the username, and its value indicates whether the user is logged in, or not. Initially, all users are not logged in.

Finally, return the dictionaries.

Note: All of the users in the bank file are in the user account file. '''

user_accounts = {} log_in = {}

# your code here

return user_accounts,log_in

########################## ### TEST YOUR SOLUTION ### ########################## bank = import_and_create_dictionary("bank.txt") user_accounts, log_in = import_and_create_accounts("user.txt")

tools.assert_false(signup(user_accounts,log_in,"Brandon","123abcABCD"))

tools.assert_false(signup(user_accounts,log_in,"BrandonK","123ABCD")) tools.assert_false(signup(user_accounts,log_in,"BrandonK","1234ABCD")) tools.assert_false(signup(user_accounts,log_in,"BrandonK","abcdABCD")) tools.assert_false(signup(user_accounts,log_in,"BrandonK","1234abcd"))

tools.assert_false(signup(user_accounts,log_in,"123abcABCD","123abcABCD"))

tools.assert_true(signup(user_accounts,log_in,"BrandonK","123aABCD")) tools.assert_false(signup(user_accounts,log_in,"BrandonK","123aABCD")) tools.assert_true("BrandonK" in user_accounts) tools.assert_equal("123aABCD",user_accounts["BrandonK"]) tools.assert_false(log_in["BrandonK"])

#user.txt

Brandon - brandon123ABC Jack Jack - jac123 Jack - jack123POU Patrick - patrick5678 Brandon - brandon123ABCD James - 100jamesABD Sarah - sd896ssfJJH Jennie - sadsaca

#bank.txt

Brandon: 5 Patrick: 18.9 Brandon: xyz Jack:

Sarah: 825 Jack : 45 Brandon: 10 James: 3.25 James: 125.62 Sarah: 2.43

Brandon: 100.5

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 Databases Questions!