8

I would like to insert a python variable into a text cell, in google colab.

For example, if a=10, I would like to insert the a into a text cell and render the value.

So in the text cell (using Jupyter Notebook with nbextensions) I would like to write the following in the text cell: There will be {{ a }} pieces of fruit at the reception.

It should show up as: There will be 10 pieces of fruit at the reception.

The markdown cheatsheets and explanations do not say how to achieve this. Is this possible currently?

Nicolas
  • 344
  • 4
  • 18

1 Answers1

3

It's not possible to change 'input cell' (either code or markdown) programmatically. You can change only the output cells. Input cells always require manually change. (even %load doesn't work)

korakot
  • 32,074
  • 13
  • 108
  • 128
  • 1
    This is not what the op is asking for. They're asking for a way to inject a variable's value into some sentence in a text cell. Mixing variables into their words. Unfortunately, @Nicolas Smoll, this does not seem to be possible. I need the same functionality :( – zelusp Dec 09 '19 at 19:40
  • This is simple explanation of a vague and unclear question. Excellent. – prosti Oct 17 '20 at 08:55