mercredi 19 février 2020

Why is the string 'andy' not printing please enter a new username?

current_users = ['Andy', 'Brett', 'Cassie', 'Derek', 'Eric']
new_users = ['eric', 'greg', 'hank', 'ian', 'john', 'andy', 'frank']
new_users.sort()

for current_user in current_users:
    current_user = current_user.lower()

for new_user in new_users:
    if new_user == current_user:
        print(f"\n{new_user}, Please enter a new username!")
    else:
        print(f"\n{new_user}, Username is available.")

Andy is being printed as username is available. Also please help me simplify as I am just learning python.

Aucun commentaire:

Enregistrer un commentaire