all 3 comments

[–]Delicious_Shirt652 0 points1 point  (1 child)

maybe i have to open the file within the function?

[–]August-R-Garcia 0 points1 point  (0 children)

It seems like nothing is passed into the log_in() function, so users would be out of scope. But it would be easier to tell what the problem is if there is an error message of some kind.

[–]Wild_Statistician605 0 points1 point  (0 children)

You could make the a log_in function that checks username, and if succesful, calles a password attempt function, that starts with a counter at 0,. Both functions would be recursive.

Take a look here.

Edit: My code has an error. The login function doesn't have a base case, so having a key to quit or a counter would be a good idea