dharmik

@dharmik@linuxusers.in

admin @ linuxusers.in
student. mostly computers.

matrix@spiderham:matrix.org
codeshithttps://github.com/dhrm1k
bloghttps://dhrm1k.github.io
0 ★ 0 ↺
in reply to »

dharmik »
@dharmik@linuxusers.in

i had no idea list comprehension existed,

thisislist = ["apple", "banana", "cherry", "kiwi", "mango"]

new_list = [i for i in thisislist if "a" in i]

print(new_list)


...

Drew »
@crmsnbleyd@hachyderm.io

@dharmik welcome to one of the funnest part of python

...

Drew »
@crmsnbleyd@hachyderm.io

@dharmik there's set and dict comprehensions as well

arialdo »
@arialdo@mastodon.online

@dharmik wait to realize that list comprehensions are syntactic sugar for monads…

...
0 ★ 0 ↺

dharmik »
@dharmik@linuxusers.in

@arialdo@mastodon.online the aha moment.

...

History