Implement the following to simulate how websites ensure that everyone has a unique username. a) Make a list of five or more usernames called current_users. b) Request an input of username. c) Print a message, Sorry XXX, that name is taken and also display the current user list if the input username has already been used. XXX is the input user name. d) Print a message, Great, XXX is still available and also display the updated user list if the username has not been used. e) Make sure your comparison is case insensitive. If 'John' has been used, 'JOHN' or ‘john’ should not be accepted. Example Output 1 Enter your user name: TOM Sorry TOM, that name is taken. Current users: [‘admin’, ‘tom’, ‘jerry’, ‘Dora’, ‘GEORGE’] Example Output 2 Enter your user name: curiousGeorge Great, curiousGeorge is still available. Updated users: [‘admin’, ‘tom’, ‘jerry’, ‘Dora’, ‘GEORGE’, ‘curiousGeorge’]
Implement the following to simulate how websites ensure that everyone has a unique username.
a) Make a list of five or more usernames called current_users.
b) Request an input of username.
c) Print a message, Sorry XXX, that name is taken and also display the current user list if the input username has already been used. XXX is the input user name.
d) Print a message, Great, XXX is still available and also display the updated user list if the username has not been used.
e) Make sure your comparison is case insensitive. If 'John' has been used, 'JOHN' or ‘john’ should not be accepted.
Example Output 1
Enter your user name: TOM
Sorry TOM, that name is taken.
Current users: [‘admin’, ‘tom’, ‘jerry’, ‘Dora’, ‘GEORGE’]
Example Output 2
Enter your user name: curiousGeorge
Great, curiousGeorge is still available.
Updated users: [‘admin’, ‘tom’, ‘jerry’, ‘Dora’, ‘GEORGE’, ‘curiousGeorge’]
Step by step
Solved in 2 steps with 2 images