Skip to content

Commit

Permalink
New iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
danaki committed Sep 25, 2019
1 parent b365f37 commit af17f96
Show file tree
Hide file tree
Showing 20 changed files with 2,443 additions and 131 deletions.
23 changes: 18 additions & 5 deletions 10_Dictionaries.ipynb

Large diffs are not rendered by default.

118 changes: 117 additions & 1 deletion 1_Intro.ipynb

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions 4_Numerics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,131 @@
"8 % 3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Also works for floats:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.858"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6.24 % 3.382"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"How to check odd or even number:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"14 % 2"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"17 % 2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"-17 % 2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that `0` is also an \"even\" number:"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0 % 2"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down Expand Up @@ -533,6 +658,68 @@
"round(25.6)"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"Round up:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from math import ceil\n",
"\n",
"ceil(2.25)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Round down:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.0"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from math import floor\n",
"\n",
"floor(2.75)"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
Loading

0 comments on commit af17f96

Please sign in to comment.