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.

5th Feb 2018, 3:17 PM
Aga Bailey
Aga Bailey - avatar
2 RĂ©ponses
+ 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
5th Feb 2018, 4:30 PM
Markus Kaleton
Markus Kaleton - avatar
0
Thank you! That makes sense now!
5th Feb 2018, 5:30 PM
Aga Bailey
Aga Bailey - avatar