Skip to content

Instantly share code, notes, and snippets.

@masasa27
Created August 1, 2020 18:28
Show Gist options
  • Select an option

  • Save masasa27/bdf7156a0dc36b9e7be9294d60ce6ca3 to your computer and use it in GitHub Desktop.

Select an option

Save masasa27/bdf7156a0dc36b9e7be9294d60ce6ca3 to your computer and use it in GitHub Desktop.
Numbers walk through
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Numbers"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# declaring a variable is simple as assigning a value to it!\n",
"num1 = 3\n",
"num2 = 10"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Addition"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"13"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"num1 + num2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Subtraction"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-7"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"num1-num2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Division"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"num1 / num2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Power"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1000"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#10 in the power of 3\n",
"num2 ** num1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The Order Matters!"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(38, 56)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3 + 5 * 7, (3 + 5) * 7 "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment