current_ids = ['mason' , 'chase' , 'erin' , 'guillermo' , 'george']
new_ids = ['sara' , 'gregory' , 'ChaSe' , 'josh' , 'Erin']
for new in new_ids:
if new.lower() in current_ids:
print("This ID is already taken. Choose another one.")
else:
print("You aight man this ID is gucci")
我试图让循环检查是否已经使用了新的ID,如果它们是那么打印出ID已被使用。根据python的说法,“Erin”和“erin”是不一样的。我想知道我需要添加什么,才能使这两个列表处于相同的情况。例如,对于两个都是小写的,都是curent_ids和new_ids。如何让列表比较不区分大小写?
做,当你运行该代码,你得到什么输出?我看起来很好。另外,如果'current_ids'是一个集合,也就是'current_ids = {'mason','chase','erin','guillermo','george'}' – mhawke