1. Given a global list of users and password like the following, write a function (called login) that takes a user name and password and logs in the user if login is successful: - the user exists in the list - and the password is correct The function should return a True/False users = {'Jane': 'Password123@', 'John': 'Password123!'}
1. Given a global list of users and password like the following, write a function (called login) that takes a user name and password and logs in the user if login is successful:
- the user exists in the list
- and the password is correct
The function should return a True/False
users = {'Jane': 'Password123@', 'John': 'Password123!'}
2. Write a function called register that takes a user name and password and adds the user to the list if the user does not already exist in the list
The function should return a True/False
Put it all together:
3. Write a showmenu function that shows the following options and reads the choice from user and returns it:
1: register
2: login
0: logout
3. In the main section, based on the user's selected option, ask the required input (user name, passwords) and perform the requested operation.
4. Repeat the above until the user enters 0. (keep showing the menu that asks for another option)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps