jueves, 31 de octubre de 2024

count lens of element on a list, and create a dict if value is greater than

>>> words

['cat', 'window', 'defenestrate']

>>> 


 >>> {a:len(a) for a in words if len(a)>5}

{'window': 6, 'defenestrate': 12}


No hay comentarios:

Publicar un comentario