python5-10 检查用户名
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)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步