Closed hcolmanccc closed 2 weeks ago
M = Set(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]) M
Is single or double quotation interchangeable?
Sage follows PEP 0008 https://doc.sagemath.org/html/en/developer/coding_basics.html
From https://peps.python.org/pep-0008/#string-quotes "In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability."
Unfortunately, Sage does not "Pick a rule and stick to it"
Zimmerman seems to prefer double quotes.
When you evaluate double quotes in a sage cell, the output will be converted to single quotes.
The only way to use a single quote in a string is to encase it in double quotes or else you will get an error. If you enter the following in a SageCell you will see:
Input:
"string"
Output:
'string'
Input:
"Sam's string"
Output:
"Sam's string"
Input:
'Sam's string'
Output:
Cell In [1], line 1
'Sam's string'
^
SyntaxError: unterminated string literal (detected at line 1)
I cannot see anywhere in this chapter how to enter a list that is not made of numbers.
Explain here how to do that, or if it is done before (I did not find it) include an example like the set of letters a, b, c.