exercise 2

Home   »   exercise 2

# creating two lists of usernames
current_users = ["Abror", "Diyora", "admin", "Biden", "Alex"]
new_users = ["Alex", "Hirsch", "Lisa",
             "admin", "Harry"]
for name in new_users:
    for other_name in current_users:
        # checking if the new username lowercased is the same as a current username lowercased
        if name.lower() == other_name.lower():
            print("Username already exists. Please enter another one.")
    # executing this in case the for loop runs completely without breaks
        print("This username is available.")

Leave a Reply

Your email address will not be published. Required fields are marked *