Today we will be working with the concept of cells and cell types.  

  1. So, in Jupyter Notebook, each of those lines where we can enter stuff is a cell. You can see that there is a cell number in the beginning  ‘In[1]’ ,  ‘ In[2] ‘ etc.  (If you are using an old file where some code is already written and you are starting from, say the 15th cell,  sometimes the numbering will be off.  Or there won’t be any number at all, just In[ ]. Don’t worry too much about it,  it has to do with this thing called ‘Kernel’  –  which we will explore much later perhaps) .  When  you press Ctrl+Enter, Python runs your code in the current cell, gives the output AND  a new cell all ready for your next input.  Sometimes you do not want that dangling new cell  (perhaps you are done for the day practicing python).   You can get rid of cells by deleting it. 


Let’s do it manually. 

Select a cell to delete (just put the cursor there)

Go to Edit

Click Delete Cell from the dropdown menu .

2. Now let’s delete a cell using keyboard shortcut.  

 Write in a cell print(“I’m here only for a short time – for the greater good!”) .

You can run it and see output just for the sake of it :3

Click back on the cell.

There will be a blinking cursor at the end of the code (or wherever you clicked on the code).

Now press ‘Esc’ button. 

This is a  cool  thing  in  Jupyter Notebooks – which  is called the ‘Command Mode’ and you can manipulate cells while you are in the Command Mode. 

           You can be sure you are in the Command Mode, if that blinking cursor disappears.

While in the Command Mode,  press ‘d’ twice. 

3. Cells can be of two  main types –  Code  and Markdown.  So far, we had been working on ‘Code’ type cells where we insert pieces of codes.

Markdown is like glorified commenting – amazing stuff.  Makes a Jupyter Notebook such a powerful explanatory document. 

          We use cells in Markdown to write text that can explain our code or describe what we are doing. 

For students learning Python, they can write answers to specific questions associated with their code as ‘plain text’  by using the Markdown mode. 

Let’s write our first Markdown cell entry. 

To make current cell Markdown:

Go to Command Mode ( press Esc)

Press ‘m’

You will notice the ‘ In [ ]’ on the left has disappeared.

Now write  What is this Markdown thing? I cannot wait to see!

Then run it! (Shift+Enter)

4. You can double-click back on that output and it will return to that Markdown cell mode.  You can edit the cell content.  Edit it so that it reads the following:

What is this Markdown thing? I cannot wait to see!

Aha!  This opens up a door of possibilities.

Were you able to go to a new line in Markdown? Does pressing the  ‘Enter’ button only once work?

5. You can return a cell into Code mode as follows:

While cell is selected,

Go to Command Mode

Press ‘y’

Do this for a cell which is already in Markdown mode and write print(“That was fun!”) and run it.

6. Now  go to a new cell and  get it into Markdown mode.

Type  # This is a Level 1 Heading.  ( Ensure the space between hashtag and the succeeding word). 

Run it.

7. Go to new cell and get it to Markdown mode. 

Type

## This is a Level 2 Heading .  Then press enter.  You will go to next line ( but same cell – just like for Code type cell).

Write   Level 2  is slightly smaller in font.

8. Go to new cell and get it to Markdown mode. 

Type

### This is a Level 3 Heading .

In next line, type:

LIh likes this the most for casual use, as it is polite and not too loud and gaudy. 

9. In a cell at Markdown mode,  write

            `print` is the first function I used in Python.

Ensure those backtick marks around print. Run the cell.

10. As the exercise for today, reproduce the text in the attached photo, exactly as it is. 

Hint:   Surround a word  or phrase by one asterisk on both sides to italicize it and two asterisks on both sides  to bold it.  E.g. *This is become italicized*  ,  **This will be bold**