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 Answers
+ 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