Daily Archives: December 27, 2017

Python: how to copy a list

To explain how to create a copy of a list, let us first create a list. We will use a simple list of 4 items: list1 = [1, 2, "a", "b"]list1 = [1, 2, "a", "b"] Why do we want … Continue reading

Posted in Python | Tagged , | 2 Comments

Python: ternary operator

In C language (and many other languages), there is a compact ternary conditional operator that is a compact if-else conditional construct. For instance, in C, a traditional if-else construct looks like: if (a > b) { result = x; } … Continue reading

Posted in Python | Leave a comment