In ex9, three quotes can give you free space to type whatever you want. So I want to test the border of quotes used in this case.
Here’s the code.
print("""
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
""")
The result is like this.
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
What if we use 4 double-quotes instead of three? My expectation is like this:
"
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"
However, it shows error in this case:
File "ex9.py", line 14
"""")
^
SyntaxError: EOL while scanning string literal
Then I use single-quotes to replace double-quotes.
print("""'
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
'""")
This time it successfully prints:
'
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
'
Then I tried four double-quotes again, but this time I place the fourth double-quote in a new line:
print("""
"
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"
""")
This time it shows as I expected in the first experiment:
"
There's something going on here.
With the three double-quotes.
Wi'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"
Quotes are interesting. Thank you for reading and feel free to discuss it with me! Other observations are also welcomed!