10

I have a markdown cell with text, and I want it to include some output from the code. For example, I have a variable a in Python that equals to 10, and I want that a markdown cell print something like this:

We have the variable a=10...

without me specifically writing down 10

1 Answer 1

8

You need to have the jupyter notebook extensions installed. There is an extension called Python Markdown which allows you to do what you want.

In your case you wrap your variable a with curly brackets {{a}}. This will lead to

enter image description here

The code in the markdown cell resulting in "We have tha variable a=10" is accordingly:

We have the variable a={{a}}.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.