Feedback for these lessons is very much welcome. If you like or hate something about a lesson let us know, either on GitHub, via Mail or just tell us in person :)
x
Easy to comprehend - Comprehensions
list
Using comprehensions make a list containing numbers from 1 to 10.
Read this (Rightclick -> Save As) file word by word, using comprehensions build a new list that contains the length of every word.
Write a function that, given two lists, builds the cartesian product of the lists with tuples.1
Try it with the two lists you’ve created earlier.
dict
Use dict comprehension to map every word of the text to it’s length.2
generator
Try the above by calling the dict()
function on a (new) generator comprehension of tuples (the generator should generate tuples3).