This code should warn me if an element in the second list is already in the first, after having put the first in lower case.
current_users = ['id_1','id_2','id_3', 'ID_4', 'id_5']
current_users_case = [current_user_case.lower() for current_user_case in current_users]
new_users = ['id_5','id_4','id_7', 'id_8', 'id_9']
for new_user in new_users:
if new_user == current_user_case:
print("Sorry, ID already taken")
else:
print("ID available")
I get this error message:
Traceback (most recent call last):
File "main.py", line 2, in <module>
from c5n9ss import *
File "/home/runner/C5py/c5n9ss.py", line 11, in <module>
if new_user == current_user_case:
NameError: name 'current_user_case' is not defined
But if I test the first two lines in the Python shell, I get the lowered list correctly.
I don't understand the error I get.