Code and markdown cell
Another perhaps stupid question : can we insert code inside a markdown cell, in such a way it can be evaluated ?
Another perhaps stupid question : can we insert code inside a markdown cell, in such a way it can be evaluated ?
To display code in a Markdown cell in Jupyter, use single backticks for inline code, triple backticks for code blocks.
For example:
In the next cell we will define `square` by
```
def square(x):
return x * x
```
will render as
In the next cell we will define
square
bydef square(x): return x * x
Some Jupyter Notebook and JupyterLab extensions allow to evaluate code in a Mardown cell in Jupyter. See:
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2020-05-09 15:30:22 +0100
Seen: 942 times
Last updated: May 09 '20
Do you mean code to be displayed, or code to be evaluated?