- Joined
- Dec 12, 2022
- Messages
- 8
- Reaction score
- 0
I am trying to write a program that ensures new users of a website all have a unique username. To do this, I am trying to make a copy of a list that's all lowercase to check new usernames against existing usernames. I am getting an error and the problem seems to be with copying the list.
Here's my code:
Any help would be appreciated.
Thanks
Here's my code:
Python:
current_users = ['nikki', 'sarah', 'steven', 'john', 'ellen']
new_users = ['nikki', 'matt', 'jonathan', 'eric', 'sarah']
current_users_lower = current_users.lower()
for user in current_users_lower:
if user in current_users_lower:
print(f"Sorry, {user}, that username is already taken.")
else:
print(f"Welcome, {user}.")
Any help would be appreciated.
Thanks