PythonMathematicaremarks
`[1, 2, 3]` (list), `(1, 2, 3)` (tuple)`{1, 2, 3}`List is mutable but tuple isn't. Tuple can be used as hash keys.
`[[1], [2], [3]]``{{1}, {2}, {3}}`
`[[1,2],[3,4]]``{{1, 2}, {3, 4}}`
`# this is a comment``(* this is a comment *)`
`command1
command2``command1; command2;`In both Mathematica and Python, `;` indicates the end of a command and suppresses its output.
???`command1; command2`Python commands can be chained by `,`; Mathematica commands can't be chained by `,`.
`'Hello world!'`, `"Hello world!"`, `'''Hello world!'''`, `"""Hello world!"""``"Hello world!"`Python uses four varieties of quotes for enclosing strings. Mathematica uses double.
`range(5,25,2)` or `list(range(5,25,2))``Range[5, 25, 2]``list(range(5,25,2))` evaluates to a list object, while `range(5,25,2)` is a range object.
`x[2:4]``x\\[[2;;4]]`slice expression
`x[2][3]``x\\[[2, 3]]`
+
`list.append(x)`AppendTo[list, x]
`lambda x: x**2``#^2&`, or `Function[{x}, x^2]`
`map(lambda x: x**2, range(5))``Map\\[#^2&, Range[5]]`