The same notebook, rendered with the source hidden — useful for dashboard-style presentations.
import%20marimo%20as%20mo
mo.md(%0A%20%20%20%20%22%22%22%0A%20%20%20%20%23%20Interactive%20Demo%0A%0A%20%20%20%20Drag%20the%20slider%20below%20%E2%80%94%20the%20output%20updates%20reactively.%0A%20%20%20%20%22%22%22%0A)
n%20%3D%20mo.ui.slider(1%2C%2020%2C%20value%3D5%2C%20label%3D%22How%20many%3F%22)%0An
mo.md(f%22You%20chose%20**%7Bn.value%7D**.%20Its%20square%20is%20**%7Bn.value%20**%202%7D**.%22)
factor%20%3D%20mo.ui.slider(1%2C%205%2C%20value%3D2%2C%20label%3D%22Multiplier%22)%0Afactor
mo.md(f%22**%7Bn.value%7D**%20%C3%97%20**%7Bfactor.value%7D**%20%3D%20**%7Bn.value%20*%20factor.value%7D**%22)
mo.md(%0A%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%20Notes%0A%0A%20%20%20%20This%20notebook%20is%20intentionally%20longer%20to%20show%20that%20the%20iframe%20grows%20to%0A%20%20%20%20fit%20however%20many%20cells%20you%20add%3A%0A%0A%20%20%20%20-%20Cells%20run%20in%20the%20browser%20via%20WebAssembly%20(Pyodide)%0A%20%20%20%20-%20Edit%20any%20cell%20and%20press%20Ctrl%2BEnter%20to%20re-run%0A%20%20%20%20-%20Dependent%20cells%20update%20reactively%0A%20%20%20%20%22%22%22%0A)
mo.ui.table(%0A%20%20%20%20%5B%7B%22i%22%3A%20i%2C%20%22i_squared%22%3A%20i%20*%20i%7D%20for%20i%20in%20range(1%2C%20n.value%20%2B%201)%5D%2C%0A%20%20%20%20selection%3DNone%2C%0A)
Run locally: marimo edit demo.py