I've made some code that has a list of new users and current users and checks to see if the username is available. If unavailable, it outputs a message saying so, otherwise outputs a message saying it's available. After this, I'm trying to append the elements of the new_users list to the current_users, on the condition that it doesn't already exist there. I would then like to print the current_users list to indicate the changes have occurred.
Here is my code so far - it only prints the current_users list without the changes still which is where my problem is.
current_users = ['alice', 'bob', 'mary', 'OSCAR', 'Simon']
new_users = ['jack', 'daniel', 'sue', 'mary', 'chris']
current_users_lower = [user.lower() for user in current_users]
for new_user in new_users:
if new_user in current_users:
print(f"{new_user} unavailable\n")
else:
print(f'{new_user} available')
if new_user not in current_users_lower:
current_users_lower.append(new_user)
print(current_users_lower)
Thank you for any help in advance. I know question formatting is really important here so i've tried my best to ask it as clearly as possible.
Thanks!