O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

5-10. Checking Usernames:

From

Cover of Python Crash Course

Note

current_users = ['neyo', 'kanye', 'taylor', 'jayZ', 'beyonce'] new_users = ['kobe', 'yaoming', 'kaka', 'jayz', 'ronaldo'] for user in new_users: taken = False for registered in current_users: if user.lower() == registered.lower(): taken = True if taken: print(user + " has been taken!") else: print(user + " not taken yet!")