mercredi 7 juillet 2021

Using if statement with condition on length of list [closed]

usernames = ['admin', 'john', 'meridith', 'aaron', 'jane']
    if len(usernames = 0):
        print("We need to find more users")
    else:
        for username in usernames:
            if username == 'admin':
                print("Hello admin, would you like to see a status report?")
            else:
                print(f"Hello {username.title()}, thank you for logging in.")

Doing an exercise in a textbook. Why does line 2 yield an error?

Aucun commentaire:

Enregistrer un commentaire