1 检查用户名5-10 2 current_users = ['Tom', 'bob', 'Alice', 'zhangsan', 'Lisi', 'John'] 3 new_users = ['zhangsan', 'tom', 'shabi', 'mahua', 'john'] 4 for new_user in new_users: 5 cnt = 0 6 for cur_user in current_users: 7 if new_user.lower() != cur_user.lower(): 8 cnt = cnt + 1 9 if cnt != len(current_users): 10 print("The name " + new_user + " has been used, please enter another name you like") 11 else: 12 print("The name " + new_user + " has not been used.")
1 guests = ['luo', 'ao', 'zeng', 'ye', 'xie', 'admin'] 2 for guest in guests: 3 print(guest) 4 del guests[0] 5 print(guests)