This is the code I have tried
L=["One","Two","Three","Four","Five"]
for i in L:
print(i,len(L[i]))
This is the code I have tried
L=["One","Two","Three","Four","Five"]
for i in L:
print(i,len(L[i]))
This code should achieve what you are looking for.
L = ["One", "Two", "Three", "Four", "Five"]
for item in L:
print(item, len(item), sep=",")
You almost had it. With for loops in Python, you get the item in the list, not the index. So you can do len(i) instead of len(L[i]). I've added code below that does what you want, using more descriptive variable names. Also, I used f-strings to format the output.
numbers = ["One", "Two", "Three", "Four", "Five"]
for number in numbers:
print(f"{number},{len(number)}")
In your code you are loop through elements of the list not the index of the elements of list. Therefor i is the element not the index. Therefore in first loop L[i] equals to L["One"] that is wrong because index must be a number. Change the code as follows then it will work.
L=["One","Two","Three","Four","Five"]
for i in L:
print(i,len(i))
Try foing it this way,
for i in L:
print(i,len(I))
because when you did it your trying to ask the list to find the index i but it was not possible.