Deck generation, Pythagorean Triplets and more

Using comprehensions to generate a deck of cards was the challenge at the end of last lesson. Here we solve that and play around with comprehensions to do some other things such as generating binaries, filtering characters out of them, and generating Pythagorean Triplets (integers that are the lengths of sides of right triangles).

Language features introduced: ? syntax for getting a character's codepoint, comprehension filters, the ~w sigil

Further reading:

Back to index

No Comments