Tag: list comprehension

Python – List Comprehension

List comprehension in Python is creation of lists from iterables and other lists, following a condition. It is lightning fast and it looks nice, because it is a 1 liner. In this article, I will show a few examples of

Tagged with: , , , , ,

Python – Calculate magic square with python

If you want to build a magic square, check this article, the python code is at the bottom – How to build a magic square A magic square is an arrangement of the numbers from 1 to N^2 (N-squared) in

Tagged with: , , , ,

Python – Reduce file path problem (with string slicing and list comprehension)

Some time ago I have started to learn Python. Today, I will present a way to solve the problem “Reduce file path”. The problem is the following – you are given a string and you should reduce it to a meaningful

Tagged with: , , ,