-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'girlscript:Python' into Python
- Loading branch information
Showing
8 changed files
with
902 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# Title (name of the topic) | ||
# Brief History of python | ||
[![Brief history](https://res.cloudinary.com/marcomontalbano/image/upload/v1631865142/video_to_markdown/images/google-drive--1UlFpH0LBUs57MM-h0nHtYSCPHo1xwJsV-c05b58ac6eb4c4700831b2b3070cd403.jpg)](https://drive.google.com/file/d/1UlFpH0LBUs57MM-h0nHtYSCPHo1xwJsV/view?usp=sharing "Brief history") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,289 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2f2f2a45-f886-408e-9dfa-8380481dc09c", | ||
"metadata": {}, | ||
"source": [ | ||
"# Arithmetic Operators\n", | ||
"Arithmetic operations are widely used for mathematical calculations." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "88741106-c070-44df-b536-73479d9df689", | ||
"metadata": {}, | ||
"source": [ | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c40f9e97-2506-4bb0-b5df-1ba82a440b37", | ||
"metadata": {}, | ||
"source": [ | ||
" ## Types of Arithmetic Operators" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ae9c4626-fd6b-4fd6-83c2-f5a883b5042a", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 1. Addition Operator ( + ) :\n", | ||
"It adds two operands together, or acts as a sign for a single operand." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "065254e4-2c6b-486d-b628-1c1c543cddf4", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a + b = 15\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 5\n", | ||
"b = 10\n", | ||
"\n", | ||
"print(\"a + b =\", a + b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6f0cb251-e53d-4eed-a147-8415b8d689f4", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 2. Subtraction Operator ( - ) : \n", | ||
"It subtracts two operands or acts as a sign for a single operand." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "4975f0ea-66c0-44b5-ab74-7656aac8dd6e", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a - b = 20\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 30\n", | ||
"b = 10\n", | ||
"\n", | ||
"print(\"a - b =\", a - b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9cbc1684-b54c-46b0-b481-b0e664481651", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 3. Multiplication Operator ( * ) :\n", | ||
"It multiplies two operands." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "68fd55aa-8599-4a80-93f3-1074f7192076", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a * b = 75\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 5\n", | ||
"b = 15\n", | ||
"print (\"a * b = \", a * b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f2464509-4e00-4e91-89ed-179565404116", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 4. Division Operator ( / ) :\n", | ||
"It divides left operand with right operand." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "455cc46d-5aa7-4824-b0c0-164540df264f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a / b = 3.0\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 15\n", | ||
"b = 5\n", | ||
"print (\"a / b = \", a / b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "452bfb9c-43ce-4c4e-9417-43046cc8dfb6", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 5. Modulus Operator ( % ) :\n", | ||
"It returns a remainder after dividing two operands." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "2037ac5a-1575-4f4b-bf51-ca195c1c0570", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a % b = 5\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 50\n", | ||
"b = 15\n", | ||
"print (\"a % b = \", a % b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7003faa5-8d7d-4520-81f0-5b9c93cf66c5", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 6. Floor Division Operator ( // ) :\n", | ||
"Floor division is a normal division operation except that it returns the largest possible integer. This integer is either less than or equal to the normal division result." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "ef7225b0-e7b1-43a7-a3b7-d7a661f27500", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a // b = 5\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 22\n", | ||
"b = 4\n", | ||
"\n", | ||
"print (\"a // b = \", a // b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3f19f93a-9d2d-45d4-9404-e4e2de6edca4", | ||
"metadata": {}, | ||
"source": [ | ||
"#### 7. Exponentiation Operator ( ** ) :\n", | ||
"It returns left operand raised to the power of right operand." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "ad79e690-8869-49b3-a54e-f56c7ec59d1f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"a ** b = 32\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"a = 2\n", | ||
"b = 5\n", | ||
"\n", | ||
"print (\"a ** b = \", a ** b)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "10fde0db-1264-4001-a315-5cdd6858c40a", | ||
"metadata": {}, | ||
"source": [ | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "722f5042-cbea-43b8-87d0-b7d07af7b70f", | ||
"metadata": {}, | ||
"source": [ | ||
"## Summary" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b8ba8898-5a39-4a7c-b0e9-b04850bdb3eb", | ||
"metadata": {}, | ||
"source": [ | ||
"| Operator \t| Function \t| Expression \t| Example \t| Example Output \t|\n", | ||
"|:--------:\t|:----------------------------------------------------:\t|:----------:\t|:--------:\t|:--------------:\t|\n", | ||
"| + \t| Addition \t| a+b \t| 6 + 5 \t| 11 \t|\n", | ||
"| - \t| Subtraction \t| a-b \t| 6 - 5 \t| 1 \t|\n", | ||
"| * \t| Multiplication \t| a*b \t| 6 * 5 \t| 30 \t|\n", | ||
"| / \t| Division \t| a/b \t| 60 / 5 \t| 12 \t|\n", | ||
"| % \t| Modulus (Remainder) \t| a%b \t| 6 % 5 \t| 1 \t|\n", | ||
"| // \t| Floor Division (Round Down whole number) \t| a//b \t| 7.2 // 2 \t| 3.0 \t|\n", | ||
"| ** \t| Left operand raised to the power of right (Exponent) \t| a**b \t| 2.5 ** 3 \t| 15.625 \t|" | ||
] | ||
} | ||
], | ||
"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.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.