0
Why do this program outputs 1?
l = ['a' 'b' 'c' 'd'] print (len(l)) IT SHOULD OUTPUT 4. HELP?
5 Antworten
+ 6
Because you didn't put commas after each array element .
Like this:
l=['a','b','c','d']
print(len(l))
+ 3
For some reason, as Monat15 said - you didn't separate the elements with a comma; the list <l> end up having just one element, a string 'abcd'.
+ 1
I tried again with commas and works. Thank you!
0
If I help you, please, rate my answer as the best
0
done