Laboratory 0: Yes, That's how we count in python!


Welcome to your first Jupyter Notebook. This is a medium that we will be using throughout the semester.

Why is this called a notebook?

Because you can write stuff in it!

Is that it?

Nope! you can write and run CODE in this notebook! Plus a bunch of other cool stuff such as making graphs, running tests and simulations, adding images, and prepare documents (such as this one!).

How do we get this?


There are online services that allow you create, modify, and export Jupyter notebooks. However, to have this on your local machines (computers), you can install Anaconda. Anaconda is a package of different software suits including "Jupyter Notebook". You can find videos on how to install Anaconda on your devices on BlackBoard:


The Environment - Let's have a look around this window!


The notebook consists of a sequence of cells. A cell is a multiline text input field, and its contents can be executed by using Shift-Enter, or by clicking Run in the menu bar. The execution behavior of a cell is determined by the cell’s type.

There are three types of cells: code cells, markdown cells, and raw cells. Every cell starts off being a code cell, but its type can be changed by using a drop-down on the toolbar (which will be “Code”, initially).

Code Cells:

A code cell allows you to edit and write new code, with full syntax highlighting and tab completion. The programming language you use depends on the kernel. What we will use for this course and the default kernel IPython runs, is Python code.

When a code cell is executed, code that it contains is sent to the kernel associated with the notebook. The results that are returned from this computation are then displayed in the notebook as the cell’s output. The output is not limited to text, with many other possible forms of output are also possible, including matplotlib figures and HTML tables. This is known as IPython’s rich display capability.

Markdown Cells:

You can document the computational process in a literate way, alternating descriptive text with code, using rich text. In IPython this is accomplished by marking up text with the Markdown language. The corresponding cells are called Markdown cells. The Markdown language provides a simple way to perform this text markup, that is, to specify which parts of the text should be emphasized (italics), bold, form lists, etc. In fact, markdown cells allow a variety of cool modifications to be applied:

# title

## major headings

### subheadings

#### 4th level subheadings

##### 5th level subheadings

These codes are also quite useful:




Anaconda.jpg


Raw Cells:

Raw cells provide a place in which you can write output directly. Raw cells are not evaluated by the notebook.

Let's meet world's most popular python!


What is python?

"Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant whitespace." - Wikipedia @ https://en.wikipedia.org/wiki/Python_(programming_language)

How to have access to it?

There are plenty of ways, from online compilers to our beloved Jupyter Notebook on your local machines. Here are a few examples of online compilers:

a. https://www.programiz.com/python-programming/online-compiler/

b. https://www.onlinegdb.com/online_python_compiler

c. https://www.w3schools.com/python/python_compiler.asp

d. https://repl.it/languages/python3

We can do the exact same thing in this notebook. But we need a CODE cell.

This is the classic "first program" of many languages! The script input is quite simple, we instruct the computer to print the literal string "hello world" to standard input/output device which is the console. Let's change it and see what happens:

How to save a notebook?

Unless stated otherwise, we want you to submit your weekly lab assignments in PDF and your exam and project deliverables in both PDF and .ipynb formats.



This notebook was inspired by several blogposts including:

Here are some great reads on this topic:

Here are some great videos on these topics:


Exercise: Let's see who you are!

Similar to the example, use a code cell and print a paragraph about you. You can introduce yourselves and write about interesting things to and about you!