0
Can someone explain how is this length calculated
Something similar came up in one of the challenges, so I tried to play with it hoping I’d figure it out but I still don’t have a good understanding so reaching it to community for help X= [[0],[1]] print(list(map(str, x))) print(‘’.join(list(map(str, x)))) print(len(‘’.join(list(map(str,x))))) I understand the output of first and second line: >>[‘[0]’, ‘[1]’] >>[0][1] >>6 But don’t understand how the last line (length of )6 is calculated. I’d appreciate a simple explanation.
2 ответов
+ 1
handled as string? 6 characters, [ ] included.
first one makes items in list strings, second joins contents of lists as a single string and the third counts its lenght in characters
0
Thank you! That makes sense now!