[Python Snippets] Python Generator Unpacking
  
    
  
  
  Python Generator Unpacking
a1 = ['abcde', 'bcde']
a2 = ['cde']
x, y = (list(map(len, ele)) for ele in [a1, a2])
>> x = [5, 4]
>> y = [3]
def solution(a1, a2): 
    for a in [a1, a2]: 
        yield list(map(len,a))
        
x, y = solution(a1, a2)      
>> x = [5, 4]
>> y = [3]