we’re tweaking style_jb2.css to render these a little more nicely
cells¶
# this is a code cell
print('hello world')
modulus = 3 * 107 * 2**30 + 1
modulushello world
344671125505and one with some plots; note that there no longer is a need to add a final ;
as myst takes care of that for us; it does trigger some sort of warning though
import matplotlib.pyplot as plt
import numpy as np
plt.title('Sine wave')
x = np.linspace(0, 2 * np.pi, 100)
y = np.sin(x)
plt.plot(x, y)[<matplotlib.lines.Line2D at 0x7f25ece672c0>]
while we’re at it, let’s see a cell with no output
# this is a code cell
# and it does not yield any outputcode blocks¶
we can have inline code in the text that go on, or
# code blocks in Python
print('hello world')// code blocks in JavaScript
console.log('hello world')# code blocks in bash
echo hello world<!-- code blocks in HTML -->
<!DOCTYPE html>
<html>
<head>
<title>hello world</title>
</head>
<body>
<h1>hello world</h1>
</body>
</html>/* code blocks in CSS */
body {
background-color: lightblue;
}and so on and so forth