Unusual output using map() and filter() in Python
Question: I'm trying to learn how to use the map() and filter() functions in Python but
when I try and use them in visual studio, I'm getting an unusual output for
each one. I know the code is probably wrong, but I can't see what it's
outputting which is making it hard to sort out!

Thanks in advance

filter()

    
    
    import functools
    
    f = ["List", "of", "super", "crazily", "long", "words"]
    
    new = lambda a, b: a if (len(a) > b) else b
    
    print (filter(new, f))
    

Serves: filter object at 0x029AD5F0

map()

    
    
    import functools
    
    f = ["List", "of", "super", "crazily", "long", "words"]
    
    map_loop = map((lambda x: len(x)), f)
    
    print (type(map_loop), map_loop) 
    

Serves: class 'map', map object at 0x0243D5D0


Answer: you need to use `list` like this:

    
    
    print (type(map_loop), list(map_loop)) 
    

demo:

    
    
    >>> f = ["List", "of", "super", "crazily", "long", "words"]
    >>> print(list(map(len,f)))     # no need of lembda,  `len` is enough
    [4, 2, 5, 7, 4, 5]
    

