I am trying to find the index of a new name in the list. I've found the new renters name, but for some reason the index function is not working.
new = ["Maria", "Eric", "Bram", 'Bernardo', 'Bob']
old = ['Karel', 'Maria', 'Eric', 'Bram', 'Bernardo']
newrenter = list(set(new) - set(old))
print(newrenter)
newindex = new.index(newrenter)
print(newindex)
Which outputs:
['Bob']
Then the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [9], in <cell line: 8>()
4 newrenter = list(set(new) - set(old))
6 print(newrenter)
----> 8 newindex = new.index(newrenter)
10 print(newindex)
ValueError: ['Bob'] is not in list
It is probably an easy conversion of the type but I cant find how?