reading-notes

This Repo required for Asac labs class 2


Project maintained by ManarAbdelkarim Hosted on GitHub Pages — Theme by mattgraham

List Comprehensions in Python

previously we used to populate lists like this

            new_list = []
            for i in old_list:
              if filter(i):
                new_list.append(expressions(i))

you can do it in a cleaner better way using list comprehensions

new_list = [expression(i) for i in old_list if filter(i)