All published worksheets from http://sagenb.org
Image: ubuntu2004
# The pound sign--also known as "crunch", "hash", "number sign", or "octothorpe"--denotes a comment
Look at the following code. It assigns values to a and b and then their sum to c.
Note that when you press the Enter key in Sage Notebook the expression is not evaluated. Either click "evaluate" or press Shift-Enter. Do so now.
Note that assignments are evaluated but not displayed. To display a previously defined variable, type its name on a line by itself or in a different input cell.
Like Python, changing the value of a will not change the value of c.
Comparison to Python
1. The exponent operater. Evaluate the following cell in both Sage and Python modes. When executed in Python, 4^2=6. Python inherited the designation of '^' as the bitwise XOR operator from C/C++. For an explanation of bitwise XOR, see: http://irc.essex.ac.uk/www.iota-six.co.uk/c/e4_bitwise_operators_and_or_xor.asp
2. Division with '/'. Evaluate the following cell in sage and Python