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!).
*Rami Malek in Mr. Robot*
The tabs:
The Icons:
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).
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.
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:
Use triple " " before and after a word (without spacing) to make the word bold and italic
B&I: **string***
or ** before and after a word (without spacing) to make the word bold
Bold: string__ or string
_ or before and after a word (without spacing to make the word italic
Italic: string or string*
Double ~ before and after a word (without spacing to make the word scratched
Scratched: string
For line breaks use "br" in the middle of <>
For colors use this code:
For indented quoting, use a greater than sign (>) and then a space, then type the text. The text is indented and has a gray horizontal line to the left of it until the next carriage return.
here is an example of how it works!
For bullets, use the dash sign (- ) with a space after it, or a space, a dash, and a space ( - ), to create a circular bullet. To create a sub bullet, use a tab followed a dash and a space. You can also use an asterisk instead of a dash, and it works the same.
For numbered lists, start with 1. followed by a space, then it starts numbering for you. Start each line with some number and a period, then a space. Tab to indent to get subnumbering.
For horizontal lines: Use three asterisks: ***
Raw cells provide a place in which you can write output directly. Raw cells are not evaluated by the notebook.
"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))
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
We can do the exact same thing in this notebook. But we need a CODE cell.
print("Hello World")
Hello World
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:
print("This is my first notebook!")
This is my first notebook!
As a notebook file (.ipynb):
Go to File > Download As > Notebook (.ipynb)
As an HTML file (.html):
Go to File > Download As > HTML (.html)
As a Pdf (.pdf):
Go to File > Download As > PDF via LaTex (.pdf)
or
Save it as an HTML file and then convert that to a pdf via a website such as https://html2pdf.com/
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.
This notebook was inspired by several blogposts including:
Here are some great reads on this topic:
Here are some great videos on these topics:
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.
print('my name is ...')
print('my favorite food is ...')
print('I am currently studying to be an ... engineer')
print('I speak 3 languages, they are: language 1, language 2, and of course profanity')
my name is ... my favorite food is ... I am currently studying to be an ... engineer I speak 3 languages, they are: language 1, language 2, and of course profanity