Month: March 2018

Daily Python Puzzle: Auto String Concatenation

What is the output of this code snippet?   [python] x = ‘py’ ‘thon’ print(x) [/python]   A well-designed puzzle conveys one single point that surprises the reader. This puzzle introduces a language feature that surprised me when I first saw it. The Python interpreter automatically concatenates two strings that are next to each other. …

Daily Python Puzzle: Auto String Concatenation Read More »

Daily Python Puzzle: String Concatenation

What is the output of this code snippet?   [python] print(3 * ‘un’ + ‘ium’) [/python]   Python has powerful built-in capabilities for string manipulation. Web companies like Google love Python because it is a perfect fit for the text-based World Wide Web. The puzzle introduces two basic string manipulation operators. The ‘+’ operator concatenates …

Daily Python Puzzle: String Concatenation Read More »