> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab-5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-science-lab-5/data-science-notebook/.ipynb-file-cells/using-a-code-cell.md).

# Using a Code Cell

A user can write and execute code using the Data Science Notebook interface. This section covers the steps to write and run a sample code in the Code cell of the Data Science Notebook.

{% hint style="success" %}
*Check out the given walk-through on how to use a Code Cell under a .ipynb file.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FrSE1mefLYXZ5goDkoB5c%2FUsing%20a%20Code%20Cell.mp4?alt=media&token=d59cc0d7-2ce8-45d9-9da9-795c26ddf28f>" %}
***Using a Code Cell***
{% endembed %}

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The above-given video displays inserting a new code cell using the Add Pre-cell icon for a code cell.*
{% endhint %}

## Running Code inside a Code Cell

* Create a new .ipynb file. &#x20;

<figure><img src="/files/1lUrIzyQXehdaNdEZIei" alt=""><figcaption></figcaption></figure>

* A notification message appears to ensure the creation of the new .ipynb file.

<figure><img src="/files/3agGwEZqIu2fA3xQeXgg" alt=""><figcaption></figcaption></figure>

* Open the newly created .ipynb file.
* Insert the first Code cell by using the Add pre-cell icon.

<figure><img src="/files/IsZ8I9SAHYZG9eSEKGdk" alt=""><figcaption></figcaption></figure>

* Write code inside the cell.
* Click the ***Run cell*** icon to run the code.

<figure><img src="/files/NBcYYuE0hFTL0Lxc5Ei5" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The Code cells also get code from the selected Notebook operations by using the right-side panel and selecting a specific option. E.g., The user can use the **Data** tab to get an added data set to the code cell.*
{% endhint %}

* The ***Run*** cell button is changed into the ***Interrupt cell*** icon while running the code.

<figure><img src="/files/MVxXsAEXL0K2NXp1wlzN" alt=""><figcaption></figcaption></figure>

* Once the code has run successfully a checkmark appears below the ***Run cell*** icon.
* The code result is displayed below it.

<figure><img src="/files/yCzDSZXZGY50x9tbd4Ga" alt=""><figcaption></figcaption></figure>

* Another code cell gets added below (as shown in the following image).
* Click the ***Save*** icon provided for the Notebook.

<figure><img src="/files/TGgjHxAnBeqx5fgnXDVO" alt=""><figcaption></figcaption></figure>

* A notification message appears to indicate the completion of the action.
* The Data Science Notebook's status gets changed as saved and the new updates get saved in it.

<figure><img src="/files/zh6x5XFOHtEgpnGDtUs8" alt=""><figcaption></figcaption></figure>

## Various Options provided to a Code Cell

By clicking on an inserted Code cell, some code-related options are displayed as shown in the image:

<table><thead><tr><th width="93">Sl. No.</th><th width="92">Icon </th><th width="178">Name</th><th>Action</th></tr></thead><tbody><tr><td>1</td><td><img src="/files/Hzb78Rwkh2vAJy7qwfpV" alt=""></td><td>Move the cell up</td><td>Moves the cell upwards</td></tr><tr><td>2</td><td><img src="/files/wJiJtq73Ur3cEDZfYGej" alt=""></td><td>Move the cell down</td><td>Moves the cell downwards</td></tr><tr><td>3</td><td><img src="/files/tTWmsCcCQrWUTnObnzZt" alt="" data-size="original"></td><td>Delete Cell</td><td>Deletes the code cell.</td></tr><tr><td>4</td><td><img src="/files/grlhmiUE9RtlrUntcmzN" alt=""></td><td>More Actions</td><td><p>Opens four more actions that include: </p><p>Transform, Save Model, Predict, and Save artifact.</p></td></tr></tbody></table>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The **+Code,*** ***+Markdown, and +Assist** options provided at the bottom of a cell insert a new cell after the given code/ Markdown cell.*    &#x20;
{% endhint %}
