mercredi 7 octobre 2020

in python how comparision of two list, we can make case insensitive?

if "Maurya" is present in current_users, then "MAURYA" should not be accepted as available username.?

current_users = ["amit", "ajit", "nishant", "mohit", "Maurya"]
new_users = ["deepak", "manish", "maurya", "akhil", "ajit"]

for new_user in new_users:
    if new_user in current_users:
        print(f"{new_user}, you need to enter new username!")
    else:
        print(f"{new_user}, This username is available.")

Aucun commentaire:

Enregistrer un commentaire