How to use python Jupiter notebooks and markdown for beginners

Share

If you’ve installed a Python in the last article, let’s see how Jupiter notebooks can be used. First, let’s run a Jupiter notebook using Anaconda Navigator.

When you run Jupiter notebook, you will see several folders that are already installed by default. Let’s create a Python 3 notebook by going into the ‘practice’ folder created in the last time.

■ Python Jupiter laptop default screen

The main screen is as follows: You can change the title of your notebook by clicking on the part that is called Untitled. In this article, I named it as ‘1. Python 101’.

Now let’s look at the cell that is called In. You can see the cursor and the green on the left. If you press ‘Esc’, it turns out blue.

  • Input mode: A mode where you can type. The color is green.
  • Command mode: A mode in which the cell executes itself or executes commands. The color is blue.

FYI, I show you a screenshot of the page. ‘1. Python 101.ipynb’ is shown in green because it is currently running.

■ Python Jupiter Notebook Shortcuts

Go back to the laptop screen and look at some useful shortcuts. If you want to see a shortcut, you can press ‘h’ in command mode (blue). h is an abbreviation for help.

List of useful shortcuts

AAdd cells to the top line (above) in the current cell
BAdd cells to the bottom line (below) in the current cell
DDDelete cells
Shift+EnterAfter the cell is run, move the cursor down the c
ell (if there is no cell, move the cursor while creating it.)
Ctrl+EnterCell execution
CCell copy
PCell paste
Shift+MMerge the current cell and the bottom cell

■ Python Jupiter Notebook Markdown

Markdown is useful when explaining the code. If you want to apply a markdown, click Cell > Cell Type > Markdown.

They are so many steps, so let’s memorize shortcuts. In command mode, pressing ‘m’ will change it to the markdown mode. If you want to enter the code again, press ‘y’.

Below are examples of various markdowns.

Let’s look at it one by one.

  • Titles: : ‘#’

First, you can use ‘#’ to write the main titles, subtitles, subheadings, etc. The more you write #s, the smaller the size. Usually, use three-#s or two-#s to use the titles. Note that you need to type ‘space’ after the # to apply markdown.

If you run the code below (ctrl+enter), you can see that the markdown is applied as in the image above.

# one-# Markdown font size

## two-# Markdown font size

### three-# Markdown font size
  • Font style: ‘*’

If you want to apply Italics, wrap with ‘*’. Usually, you can find ‘*’ on the key with number 8.

If you want to apply a bold, wrap two-*s like ‘**’.

*Italics*: wrap with one-* to the beginning and end of the word.

**Bold** : Wrap with two-* to the beginning and end of the word. 
  • List: ‘-‘ and ‘numbers.’

If you want to write an unordered list, or bulletpoint, you can use ‘-‘. Be careful about spacing. If you want to enter the bullet as a sub-unit under neath the bullet, simply indent (space) and then insert ‘-‘.

If you want to make a list where the order is meaningful, write number and dot like ‘1.’ and type whatever you want to type.

- Bullet: If you write '-' and type 'space', it will be marked with bullets.  
 - Sub-bullet: After indentation, type '- ' to make it sub-bullet.

1. If you want to create a ordered list
2. You can write a 'number and .'
  • Quote: ‘>’

Quotations can be written after ‘>’. After all, it is important to type a ‘space’.

> Enter quotations: Start with '>'.
  • Formula: ‘$’

When using the formula, wrap it in $. It can be written as x or y, but the alphabet changes as shown in mathematics.

$x=y+10$ formula is written in $.
  • Link: ‘[]’ and ‘()’

When you write a link, the hyperlink works even if you just put the URL itself. But if you want to describe the link URL, you can write the link description inside ‘[]’ and type the link URL in ‘()’. There should be no spacing between the ‘[]’ and ‘()’

[마케터 루시씨 홈페이지](https://lucy-the-marketer.kr/)
There should be no spacing between '[description]' and '(link URL)' 
  • Code entry: “` (three-`)

If you want to type code, use the ‘. You can find it with ‘~’ sign on your keyboard.

'''python'
print ('hello world')
```

Now you can begin with Python Jupiter notebook!

Leave a Reply

Your email address will not be published. Required fields are marked *