current_users = ['Tifa', 'Ada', 'Lightning', 'Lion', 'Natasha']new_users = ['Tifa', 'Ada', 'Lucifer', 'liON', 'Michael']#下面是我写的代码,该如何在用户名为liON时打印出'Username is uese'?for new_user in new_users: print(new_user) if new_user in current_users: print('Username is uesd') else: print('Username is not used')
1 回答
Good丶study
TA贡献1条经验 获得超0个赞
current_users = ['Tifa', 'Ada', 'Lightning', 'Lion', 'Natasha']
new_users = ['Tifa', 'Ada', 'Lucifer', 'liON', 'Michael']
for new_user in new_users:
print(new_user)
if new_user.lower() in [value.lower() for value in current_users]:
print('You need another name!')
else:
print('You can use this name!')
添加回答
举报
0/150
提交
取消