I tried this following code but it has not worked so far it says that I cannot
names = ['John Johnson Doe', 'Jane Janis Doe']
firstnames = []
for name in names:
firstnames.append(names[name].split(' ')[0])
print(firstnames)
The error I am getting here is:
TypeError: list indices must be integers or slices, not str