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
modulus
hello world
344671125505
and 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 0x7fa454529880>]

while we’re at it, let’s see a cell with no output
# this is a code cell
# and it does not yield any output
code 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