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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started