Cells - ( Basic Jupyter )
Heading h2
Syntax
In Jupyter, code can be written and executed in cells. To create a new cell, click on the +
button in the toolbar or use the Ctrl+Shift+Enter
keyboard shortcut. To run a cell, use the Shift+Enter
keyboard shortcut.
Example
# This is a markdown cell
## Heading h2
# This is a code cell
print("Hello, world!")
Output
Hello, world!
Explanation
Jupyter cells can contain either code or markdown. To change the cell type, select the cell and use the dropdown menu in the toolbar or use the Esc
key followed by either Y
for code or M
for markdown.
In the above example, we have a markdown cell and a code cell. The code cell contains a print()
statement that outputs "Hello, world!" when the cell is executed.
Use
Jupyter cells allow for a more interactive and flexible way of writing and executing code. Cells can be rearranged, edited, and executed independently, making it easier to explore and try out different ideas and concepts.
Important Points
- Jupyter cells can contain either code or markdown
- To create a new cell, use the
+
button in the toolbar orCtrl+Shift+Enter
- To run a cell, use
Shift+Enter
- To change a cell type, use the dropdown menu or
Esc
key followed byY
for code orM
for markdown - Cells in Jupyter allow for an interactive and flexible coding environment
Summary
In conclusion, Jupyter cells provide a more flexible and interactive way of writing and executing code. They can contain either code or markdown, and can be rearranged, edited, and executed independently. Jupyter is a powerful tool for exploring and experimenting with different ideas and concepts.