Aug-27-2020, 06:13 PM
If tmp is a list of lists. for x in tmp makes x a list. You cannot use a list as an index into a list. I think you want to do this:
You should also think about what type of data structures best fit your problem. I don't know anything this challenge, but if you used a dictionary instead of a list of lists your test for unique password is:
for x in tmp: if new_id == x[0]:tmp is a bad variable name. It tells me nothing about what the variable is or how I should use it. I think that you would have fewer problems if you started using better variable names.
You should also think about what type of data structures best fit your problem. I don't know anything this challenge, but if you used a dictionary instead of a list of lists your test for unique password is:
if passwords.get(new_id): print("That ID is already on the list") else: break;And one last quibble. Printing is not the same as returning.
print("That ID is already on the list") # if it is return this error messageMisleading comments are far worse than no comment at all.