reading-notes

View project on GitHub

List Comprehensions:

provide a concise way to create lists.

* It consists of brackets containing an expression followed by a for clause, then zero or more for or if clauses. The expressions can be anything, meaning you can put in all kinds of objects in lists.*

EX:

The list comprehension starts with a ‘[‘ and ‘]’, square brackets, to help you remember that the

result is going to be a list

new_list

The new list (result).

expression(i)

Expression is based on the variable used for each element in the old list.

for i in old_list

The word for followed by the variable name to use, followed by the word in the old list.

if filter(i)

Apply a filter with an If-statement.

Primer on Python Decorators:

Function: returns a value based on the given arguments.

First-Class Objects: functions can be passed around and used as arguments

Inner Functions: define functions inside other functions.

Resources:

Done by Omar-zoubi