Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Executable cells in markdown

This file adapted from this JupyterBook example.

print("A python cell")
A python cell

Try a simpler version:

print("A python cell")
A python cell

Try glue

See https://jupyterbook.org/en/stable/content/executable/output-insert.html

from myst_nb import glue
my_variable = "here is some text!"
glue("cool_text", my_variable)
'here is some text!'

Now we can try to use this: cool_text

Do it again, hiding the cell input and output:

Now we can try to use this: my_text

Hide input with a button to show it

See https://jupyterbook.org/en/stable/interactive/hiding.html

Source
bignumber = 2**32
glue('bignumber',bignumber)

What power of 2 is this big number: bignumber?

Source
print(f'Hint, the 8th root of this number is {bignumber**(1/8):.0f}')
Hint, the 8th root of this number is 16