# Find how a is defined with each underscore representing a character

Here is a puzzle for python programmers (python3+):

Find how a is defined (for example, a = 2 + True), with each underscore representing a character (there is no trail of whitespaces on the left and right)

a = _____
print(a+a)


Output:



Edit for narrowing down the answer:

Here are the only characters you can work with:  , ,, ", +

• You should specify the version of Python. For example, in python 2.*, a = ur' ' would've worked. It doesn't in newer versions. Oct 14 '20 at 16:04

Solution:

" """

Explanation:

This is simply the concatenation of a single space " " and the empty string "". The three quotation marks on the right are not parsed as a triple quote because the first one is paired with the one before the space.

If I'm reading the puzzle correctly, easiest answer would be

a=' '*1

Explanation:

The output is two spaces, and there are 5 underscores for the value of a. Output is achieved by concatenating a to a, so we know a must be a single space, achieved using 5 characters. In Python a string can be duplicated using multiply, so we have the string of a single space (3 characters), multiplied by 1 (an additional two characters).

• There are lots of ways to burn the two excess characters: " "## f" "; r' '; (' ') or even " ";\  I'm sure there are more. Oct 14 '20 at 17:04
• @PaulPanzer Yeah, there are a ton. I just figured my answer was the easiest to explain to a non-programmer while still looking "pythony" (I forget the term pythonistas use to describe python code) Oct 14 '20 at 18:48
• I suspect OP had one very specific answer in mind and underestimated how many other ways there are, cf their edits. Oct 14 '20 at 18:59