0
Please explain this code
X=[12,34] print(len(list(map(int,x))))
2 Answers
+ 8
https://docs.python.org/3/library/functions.html#map
map(int, x)
takes list x and builds an iterable using the results of calling int() with each element of list x.
You then convert the iterable object to list, which returns basically the same list as x, since elements in x are already integer values originally. The len function returns the number of elements in the list, which is 2.
+ 3
It is simple it will create 2 as a output
map() : it calls the specified function for each item of an iterable (such as string, list, tuple or dictionary) and returns a list of results.
list() : this will convert everything in list but not required here at all
len() : this finds the length of anything like (string, list, tuple or dictionary)