Download (right-click, save target as ...) this page as a jupyterlab notebook from:

Laboratory 1


Laboratory 1: A Notebook Like No Other!

LAST NAME, FIRST NAME

R00000000

ENGR 1330 Laboratory 1 - In-Lab

Welcome to your first (or second) Jupyter Notebook. This is the 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 building documents (such as this one!).

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


*Rami Malek in Mr. Robot*


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:

If you want to provide structure for your document, you can use markdown headings. Markdown headings consist of 1 to 5 hash # signs followed by a space and the title of your section. (The markdown heading will be converted to a clickable link for a section of the notebook. It is also used as a hint when exporting to other document formats, like PDF.) Here is how it looks:

# title

## major headings

### subheadings

#### 4th level subheadings

##### 5th level subheadings

These codes are also quite useful:

change this to a merkdown cell and run it!

Text
Text
Text




Anaconda.jpg


Raw Cells:

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

Thi$ is a raw ce11

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 lab assignments in PDF and your exam and project deliverables in both PDF and .ipynb formats.


Readings

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 hello world example, use a code cell and print a paragraph about you. You can introduce yourselves and write about interesting things to and about you! A few lines bekow can get you started, replace the ... parts and the other parts to make your paragraph.