Category Archives: Challenges

A classic programming challenge, in Python

It has become a tradition for computer scientists to create various self referential ‘strange loops’. Traditions such as writing a compiler in the language it compiles are actually quite useful – and also very interesting. This tradition also branched to … Continue reading

Posted in Challenges, computer science, Programming Philosophy, Python | Tagged , , | 6 Comments

Small Python Challenge No. 1

I bet I already wrote that sometime earlier, but I found myself today writing the following function: def blocks(seq, block_len): “”"blocks(range(5),2) -> [[0, 1], [2, 3], [4]]”"” seq_len = len(seq) if seq_len%block_len == 0: num_blocks = seq_len/block_len else: num_blocks = … Continue reading

Posted in Challenges, Programming, Python | Tagged , | 13 Comments