From 4c4dfa14852024753b1d300398864c683d0911d1 Mon Sep 17 00:00:00 2001 From: Jiggly-Balls Date: Sun, 11 Oct 2026 20:49:53 +0530 Subject: [PATCH 1/6] Fix minor formatting --- docs/python-tutorial/chapters/05-string-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/python-tutorial/chapters/05-string-functions.md b/docs/python-tutorial/chapters/05-string-functions.md index 0f88b01..b038dd1 100644 --- a/docs/python-tutorial/chapters/05-string-functions.md +++ b/docs/python-tutorial/chapters/05-string-functions.md @@ -220,5 +220,5 @@ Here are some general rules for their usage. - Use **f-string** interpolation for most situations. They are the shortest, the most readable, and the most common way to write modern Python. -- Use **concatenation (+)** for simple cases where you want to join two strings only. +- Use **concatenation (`+`)** for simple cases where you want to join two strings only. - **`str.format()`** when you are reading older code. From d683e5c7259263da72fc99f797e50d675a2cb88b Mon Sep 17 00:00:00 2001 From: Jiggly-Balls Date: Sun, 11 Oct 2026 20:50:24 +0530 Subject: [PATCH 2/6] Added chapter 06-operators-pt01 --- .../chapters/06-operators-pt01.md | 157 ++++++++++++++++++ docs/python-tutorial/chapters/index.md | 3 +- docs/static/python-tutorial/06-operators.png | Bin 0 -> 2197 bytes zensical.toml | 1 + 4 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 docs/python-tutorial/chapters/06-operators-pt01.md create mode 100644 docs/static/python-tutorial/06-operators.png diff --git a/docs/python-tutorial/chapters/06-operators-pt01.md b/docs/python-tutorial/chapters/06-operators-pt01.md new file mode 100644 index 0000000..ef320ce --- /dev/null +++ b/docs/python-tutorial/chapters/06-operators-pt01.md @@ -0,0 +1,157 @@ +--- +description: Comparison and Arithmetic Operations in Python. +--- + +# Comparison and Arithmetic Operations + +A quick revision on what all concepts we have learned so far: + +- Brief on Python history +- Variables +- Data types (strings, integers, floats, booleans) +- String concatenation & interpolation + +In this chapter we will be looking at what comparison and arithmetic operations are. + +## Comparison Operators + +Comparison Operators (also known as Relational Operators), are used to compare values. They're very +similar to how they're in mathematics. + +There are six types of comparison operators as follows: + +| Operator Symbol | Name | +| ---------------- | ----------------------------- | +| `>` | Greater Than | +| `<` | Lesser Than | +| `==` | Equal To | +| `!=` | Not Equal To | +| `>=` | Greater Than Or Equal To | +| `<=` | Lesser Than Or Equal To | + +Comparison operators always return a boolean values (`True` or `False`) when used. + +
+ +![Image title](/static/python-tutorial/06-operators.png){ width="640" } + +
+ The either side of the operator is what we call an operand. +
+ +
+ +### Greater Than Operator (`>`) + +Checks if the left hand side operand is larger than the right hand side operand. + +```py +print(1 > 2) +print(20 > 1) +print(3.2 > 9) +``` + +Running this will give us the following output: ```text False True False ``` + +This reads almost like plain English! 1 is not greater than 2, hence it returns and prints out +`False`. 20 is larger than 1, which results the output being `True`, and so on. + +### Lesser Than Operator (`<`) + +Checks if the right hand side operand is larger than the left hand side operand. + +```py +print(3 < 9) +print(200 < 100) +print(23.12 < 9) +``` + +Output: + +```text +True +False +False +``` + +### Equal To Operator (`==`) + +Checks if both left and right hand side operands are exactly equal. + +```py +print(123 == 321) +print(909 == 909) +print(812 == 22) +``` + +Output: + +```text +False +True +False +``` + +!!! warning + + Do not confuse between the Equivalence Operator (`==`) and the Assignment Operator (`=`). The + Equivalence Operator is used to check if both the operands are equal, whereas the Assignment + Operator is used to assign data to a variable. + +### Not Equal To Operator (`!=`) + +Checks if both the operands are _not_ equal. + +```py + +print(10 != 10) +print(3 != 4) +print(3 != 8) +``` + +Output: + +```text +False +True +True +``` + +### Greater Than Or Equal To Operator (`>=`) + +Checks if the left hand side operand is either greater than or equal to the right hand side operand. + +```py +print(90 >= 18) +print(23 >= 32) +print(1 >= 0) +``` + +Output: + +```text +True +True +False +``` + +Here, 90 is greater than 18 which gives us `True` as the output. 23 is not greater but it is equal +to 23 which also gives us `True` as the output. + +### Lesser Than Or Equal To Operator (`<=`) + +Checks if the right hand side operand is either greater than or equal to the left hand side operand. + +```py +print(4 <= 18) +print(9 <= 3) +print(10 <= 10) +``` + +Output: + +```text +True +False +True +``` diff --git a/docs/python-tutorial/chapters/index.md b/docs/python-tutorial/chapters/index.md index cef56e7..2015e9b 100644 --- a/docs/python-tutorial/chapters/index.md +++ b/docs/python-tutorial/chapters/index.md @@ -14,8 +14,7 @@ in-depth Python features. - [Data Types pt 1 (`string`, `int`, `float` & `bool`)](03-data-types-pt01.md) - [Builtin Functions pt 1 (`print`, `input` & type casting)](04-built-in-functions-pt01.md) - [String Interpolation & Concatenation (f-strings, `str.format` & `+`)](05-string-functions.md) -- String Interpolation & Concatenation (f-strings, str.format & +) -- Operators pt 1 (Comparison & Arithmetic) +- [Operators pt 1 (Comparison & Arithmetic)](06-operators-pt01.md) - Conditional Statements (`if`, `else` & `elif`) - Operators & Conditional Statements pt 2 (Logical operators) - Data Types pt 2 (`list` & `tuple`) diff --git a/docs/static/python-tutorial/06-operators.png b/docs/static/python-tutorial/06-operators.png new file mode 100644 index 0000000000000000000000000000000000000000..2638bf0eed9ae86c8a897240ebbbcf57e63551c1 GIT binary patch literal 2197 zcmeAS@N?(olHy`uVBq!ia0y~yU}|7sV07SM1B&RJJqwaxEDmyaVpw-h<|P9Ihrg$b zV@SoEw|5=$Zd-{sTzqx7`o)6PZ@hM$;@iYk`XlfP+maJ1Z|@YhIp$p4#uOt^_i)?$ z-~V_S8hZYR=`%1i>|{}3aOh!RVdxM9T4cy1z@Xs9z{GHb!-1hef{}wkK$(G&AqkJ7 z8Mj}tI@~<}e!sr$zw5{Qm#=O8`L6b#U2p=MHKu{i3I-=T^#9DSJa?5@-FTCLJ^EOj0`gljm&BoSKHJV&dF5^mbic^BM+l2Tkel}^ zHmzo6UT-nu;|t6Feb=rYRtmpf|1~PTEnwZf;MMoD6J#+p&d9z0z4oh8!^d~L>=H~2 z8Jn0fLer3i3FruR>|vg_TAab4dGQB^f9W_>;E5H~s5_JUm5IUb_4Dud|NnUdiX{8z z#`DA1c>9nXibYP}^=hfw6 zYxe!KwyetP5O%&+M2_Q56o|~R|Ek<4C;9#C#=_E4tmeoPOnf{f6 ztG}rJsE*IGFSePscuR$;^1J)S_4Wsz-^5x*s7rrMEsbw_ezj+Z`rYRwge*820i9G~ zczfI0I3|YpIane^Q6M7Y{`afiCw7>}JpRkRip1b2raVPU&X}q44zS!#Xsf*+uFv=& z6-({}7L?+fb8jy_E?t%|t@`__-~9KQad_p(^cV8H6Yo^t1D3|=>*~Km0ZZeV*G-E5 zp5J#)TjJwC#^YGbhvxnR@$38!+ExAO=)66%e}DS3ukJpM^DF;^_VqSjPr@v)k~vr+ z(ykmhXsgV|m$t6H<*NHbNuI`1ECI;V$WXuY*U^8*_g-@UH)dDU>f>v(`4#)%Ggh?+ zoYMEP)IYUMxBGYI^EnxdomofHx86E)z2r+}c>TG6L`;`}E3|EQPl%?(+TP=7_@08P x1egpsj6X15z#>JcIwTlVbW*z2Y2WEe{ Date: Sun, 11 Oct 2026 21:25:54 +0530 Subject: [PATCH 3/6] Finished Arithmetic section --- .../chapters/06-operators-pt01.md | 249 +++++++++++++++++- 1 file changed, 243 insertions(+), 6 deletions(-) diff --git a/docs/python-tutorial/chapters/06-operators-pt01.md b/docs/python-tutorial/chapters/06-operators-pt01.md index ef320ce..ce6d1e8 100644 --- a/docs/python-tutorial/chapters/06-operators-pt01.md +++ b/docs/python-tutorial/chapters/06-operators-pt01.md @@ -45,7 +45,7 @@ Comparison operators always return a boolean values (`True` or `False`) when use Checks if the left hand side operand is larger than the right hand side operand. -```py +```python print(1 > 2) print(20 > 1) print(3.2 > 9) @@ -60,7 +60,7 @@ This reads almost like plain English! 1 is not greater than 2, hence it returns Checks if the right hand side operand is larger than the left hand side operand. -```py +```python print(3 < 9) print(200 < 100) print(23.12 < 9) @@ -78,7 +78,7 @@ False Checks if both left and right hand side operands are exactly equal. -```py +```python print(123 == 321) print(909 == 909) print(812 == 22) @@ -102,7 +102,7 @@ False Checks if both the operands are _not_ equal. -```py +```python print(10 != 10) print(3 != 4) @@ -121,7 +121,7 @@ True Checks if the left hand side operand is either greater than or equal to the right hand side operand. -```py +```python print(90 >= 18) print(23 >= 32) print(1 >= 0) @@ -142,7 +142,7 @@ to 23 which also gives us `True` as the output. Checks if the right hand side operand is either greater than or equal to the left hand side operand. -```py +```python print(4 <= 18) print(9 <= 3) print(10 <= 10) @@ -155,3 +155,240 @@ True False True ``` + +## Arithmetic Operators + +## Arithmetic Operators + +Arithmetic operators let us perform mathematical calculations in Python. You've already seen one of +them, the `+` operator, in our calculator example. Python supports seven of them: + +| Operator | Name | Example | Result | +| -------- | -------------- | -------- | ------ | +| `+` | Addition | `7 + 2` | `9` | +| `-` | Subtraction | `7 - 2` | `5` | +| `*` | Multiplication | `7 * 2` | `14` | +| `/` | Division | `7 / 2` | `3.5` | +| `//` | Floor Division | `7 // 2` | `3` | +| `%` | Modulus | `7 % 2` | `1` | +| `**` | Exponentiation | `7 ** 2` | `49` | + +Let's take a look at each of them. + +### Addition, Subtraction & Multiplication + +These three work exactly as they do in mathematics: + +```python +apples = 10 +oranges = 4 + +print(apples + oranges) +print(apples - oranges) +print(apples * oranges) +``` + +```text +14 +6 +40 +``` + +!!! note + + Notice that we use `*` for multiplication, not `x`. The same goes for division, where we use `/` + instead of `÷`. + +### Division + +The `/` operator divides the left value by the right value: + +```python +print(10 / 4) +print(10 / 5) +``` + +```text +2.5 +2.0 +``` + +Notice that the second result is `2.0` and not `2`. In Python, the `/` operator **always** returns a +float, even when the result is a whole number. + +!!! warning + + Dividing by zero is not possible, in Python or in mathematics. If you try, Python will stop your + program with a `ZeroDivisionError`. + +### Floor Division + +Floor division (`//`) divides the left value by the right value, and then rounds the result **down** +to the nearest whole number. In other words, it throws away the decimal part: + +```python +print(7 // 2) +print(10 // 3) +``` + +```text +3 +3 +``` + +This is useful when you only care about how many _complete_ times a number fits into another. For +example, how many full hours are in 150 minutes: + +```python +minutes = 150 +print(minutes // 60) +``` + +```text +2 +``` + +### Modulus + +The modulus operator (`%`) gives us the **remainder** left over after a division. Remember long +division from school? `7 ÷ 2` is `3` with a remainder of `1`, so `7 % 2` is `1`: + +```python +print(7 % 2) +print(10 % 3) +print(10 % 5) +``` + +```text +1 +1 +0 +``` + +If we continue our minutes example, `%` tells us how many minutes are _left over_ after taking out +the full hours: + +```python +minutes = 150 +print(minutes // 60) # full hours +print(minutes % 60) # leftover minutes +``` + +```text +2 +30 +``` + +So 150 minutes is 2 hours and 30 minutes. + +??? note "A common use of modulus" + + Modulus is the standard way to check if a number is even or odd. Any even number divided by `2` + leaves a remainder of `0`, while any odd number leaves a remainder of `1`: + + ```python + print(8 % 2) # 0, so 8 is even + print(9 % 2) # 1, so 9 is odd + ``` + +### Exponentiation + +The `**` operator raises the left value to the power of the right value: + +```python +print(2 ** 3) +print(5 ** 2) +``` + +```text +8 +25 +``` + +`2 ** 3` means `2 * 2 * 2`, which is `8`. + +## Order of Operations + +When an expression has more than one operator, Python follows the same order of operations you +learned in mathematics (often remembered as PEMDAS or BODMAS). Operators with the same priority are +evaluated from left to right. Let's see it in action: + +```python +print(2 + 3 * 4) +print((2 + 3) * 4) +``` + +```text +14 +20 +``` + +In the first line, multiplication happens before addition, so `3 * 4` is calculated first, giving +`2 + 12`. In the second line, the parentheses force `2 + 3` to be calculated first, giving `5 * 4`. + +!!! tip + + When in doubt, use parentheses. Even if they aren't needed, they make your code easier to read and + make sure the calculation happens in the order you intended. + +## Mixing Integers and Floats + +When you do arithmetic between an integer and a float, the result will always be a float: + +```python +print(5 + 2.0) +print(3 * 1.5) +``` + +```text +7.0 +4.5 +``` + +## In-place Operations + +It's very common to update a variable using its own value, such as adding to a score: + +```python +score = 10 +score = score + 5 +print(score) +``` + +```text +15 +``` + +Python provides a shorter way of writing this. Placing the operator before the `=` does the same +thing: + +```python +score = 10 +score += 5 +print(score) +``` + +```text +15 +``` + +`score += 5` is exactly the same as `score = score + 5`. This works with all of the arithmetic +operators: + +```python +number = 100 + +number -= 20 # number = number - 20 +number *= 2 # number = number * 2 +number /= 4 # number = number / 4 +number %= 10 # number = number %= 10 +number += 1 # number = number + 1 + +print(number) +``` + +Output: + +```text +1.0 +``` From 3e25b78d62f39c3552fc195041f5d999c2a2d303 Mon Sep 17 00:00:00 2001 From: Jiggly-Balls Date: Mon, 12 Oct 2026 00:43:40 +0530 Subject: [PATCH 4/6] Fix output errors, grammar & added comparison with strings --- .../chapters/06-operators-pt01.md | 76 ++++++++++++++----- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/docs/python-tutorial/chapters/06-operators-pt01.md b/docs/python-tutorial/chapters/06-operators-pt01.md index ce6d1e8..86f5375 100644 --- a/docs/python-tutorial/chapters/06-operators-pt01.md +++ b/docs/python-tutorial/chapters/06-operators-pt01.md @@ -1,42 +1,43 @@ --- -description: Comparison and Arithmetic Operations in Python. +description: Comparison and Arithmetic Operators in Python. --- -# Comparison and Arithmetic Operations +# Comparison and Arithmetic Operators -A quick revision on what all concepts we have learned so far: +A quick revision of the concepts we have learned so far: - Brief on Python history - Variables - Data types (strings, integers, floats, booleans) +- Built in functions - String concatenation & interpolation In this chapter we will be looking at what comparison and arithmetic operations are. ## Comparison Operators -Comparison Operators (also known as Relational Operators), are used to compare values. They're very -similar to how they're in mathematics. +Comparison Operators (also known as Relational Operators) are used to compare values. They work very +similar to how they do in mathematics. -There are six types of comparison operators as follows: +There are six comparison operators: | Operator Symbol | Name | | ---------------- | ----------------------------- | | `>` | Greater Than | -| `<` | Lesser Than | +| `<` | Less Than | | `==` | Equal To | | `!=` | Not Equal To | | `>=` | Greater Than Or Equal To | -| `<=` | Lesser Than Or Equal To | +| `<=` | Less Than Or Equal To | -Comparison operators always return a boolean values (`True` or `False`) when used. +Comparison operators always return a boolean value (`True` or `False`) when used.
![Image title](/static/python-tutorial/06-operators.png){ width="640" }
- The either side of the operator is what we call an operand. + Either side of an operator is what we call an operand. An operator is a symbol that performs an action on values, called operands.
@@ -56,7 +57,7 @@ Running this will give us the following output: ```text False True False ``` This reads almost like plain English! 1 is not greater than 2, hence it returns and prints out `False`. 20 is larger than 1, which results the output being `True`, and so on. -### Lesser Than Operator (`<`) +### Less Than Operator (`<`) Checks if the right hand side operand is larger than the left hand side operand. @@ -94,16 +95,15 @@ False !!! warning - Do not confuse between the Equivalence Operator (`==`) and the Assignment Operator (`=`). The - Equivalence Operator is used to check if both the operands are equal, whereas the Assignment - Operator is used to assign data to a variable. + Do not confuse the Equal To Operator (`==`) with the Assignment Operator (`=`). The Equal To + Operator is used to check if both the operands are equal, whereas the Assignment Operator is used to + assign data to a variable. ### Not Equal To Operator (`!=`) Checks if both the operands are _not_ equal. ```python - print(10 != 10) print(3 != 4) print(3 != 8) @@ -131,14 +131,14 @@ Output: ```text True -True False +True ``` Here, 90 is greater than 18 which gives us `True` as the output. 23 is not greater but it is equal to 23 which also gives us `True` as the output. -### Lesser Than Or Equal To Operator (`<=`) +### Less Than Or Equal To Operator (`<=`) Checks if the right hand side operand is either greater than or equal to the left hand side operand. @@ -156,7 +156,47 @@ False True ``` -## Arithmetic Operators +### Comparison with Strings + +Comparison operators aren't limited to numbers. They work with strings too. The most common use is +checking whether two strings are equal: + +```python +print("Alan" == "Alan") +print("Alan" != "James") +``` + +Output: + +```text +True +True +``` + +!!! warning + + String comparison is case sensitive, so `"alan"` and `"Alan"` are **not** equal: + +```python +print("alan" == "Alan") +``` + +Output: + +```text +False +``` + +Python compares strings character by character, so even a single difference, including an extra +space, makes the strings unequal. + +??? note "Using `<` and `>` with strings" + + The other operators work on strings as well. Python compares strings alphabetically, character by + character, so `"apple" < "banana"` is `True` because `"a"` comes before `"b"`. + + Be careful with uppercase and lowercase, though. Every uppercase letter is considered "smaller" than + every lowercase letter, so `"Zebra" < "apple"` is `True`. ## Arithmetic Operators From dc9ea115c050e1407bc01049898dea0b8bda712d Mon Sep 17 00:00:00 2001 From: Jiggly-Balls Date: Mon, 12 Oct 2026 02:21:37 +0530 Subject: [PATCH 5/6] Rewording --- docs/python-tutorial/chapters/06-operators-pt01.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/python-tutorial/chapters/06-operators-pt01.md b/docs/python-tutorial/chapters/06-operators-pt01.md index 86f5375..816fbc4 100644 --- a/docs/python-tutorial/chapters/06-operators-pt01.md +++ b/docs/python-tutorial/chapters/06-operators-pt01.md @@ -54,8 +54,8 @@ print(3.2 > 9) Running this will give us the following output: ```text False True False ``` -This reads almost like plain English! 1 is not greater than 2, hence it returns and prints out -`False`. 20 is larger than 1, which results the output being `True`, and so on. +This reads almost like plain English! 1 is not greater than 2, hence it returns `False` and prints +it out. 20 is larger than 1, which results the output being `True`, and so on. ### Less Than Operator (`<`) @@ -321,16 +321,6 @@ print(minutes % 60) # leftover minutes So 150 minutes is 2 hours and 30 minutes. -??? note "A common use of modulus" - - Modulus is the standard way to check if a number is even or odd. Any even number divided by `2` - leaves a remainder of `0`, while any odd number leaves a remainder of `1`: - - ```python - print(8 % 2) # 0, so 8 is even - print(9 % 2) # 1, so 9 is odd - ``` - ### Exponentiation The `**` operator raises the left value to the power of the right value: From b396517060f5a13469793fd151d38cd864df8e67 Mon Sep 17 00:00:00 2001 From: Jiggly-Balls Date: Wed, 14 Oct 2026 04:56:34 +0530 Subject: [PATCH 6/6] Fixes for Maha reviews --- .../chapters/06-operators-pt01.md | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/docs/python-tutorial/chapters/06-operators-pt01.md b/docs/python-tutorial/chapters/06-operators-pt01.md index 816fbc4..f18fbc0 100644 --- a/docs/python-tutorial/chapters/06-operators-pt01.md +++ b/docs/python-tutorial/chapters/06-operators-pt01.md @@ -12,23 +12,23 @@ A quick revision of the concepts we have learned so far: - Built in functions - String concatenation & interpolation -In this chapter we will be looking at what comparison and arithmetic operations are. +In this chapter, we will be looking at what comparison and arithmetic operations are. ## Comparison Operators Comparison Operators (also known as Relational Operators) are used to compare values. They work very -similar to how they do in mathematics. +similarly to how they do in mathematics. There are six comparison operators: | Operator Symbol | Name | | ---------------- | ----------------------------- | -| `>` | Greater Than | -| `<` | Less Than | -| `==` | Equal To | -| `!=` | Not Equal To | -| `>=` | Greater Than Or Equal To | -| `<=` | Less Than Or Equal To | +| `>` | Greater than | +| `<` | Less than | +| `==` | Equal to | +| `!=` | Not equal to | +| `>=` | Greater than or equal To | +| `<=` | Less than or equal to | Comparison operators always return a boolean value (`True` or `False`) when used. @@ -44,7 +44,7 @@ Comparison operators always return a boolean value (`True` or `False`) when used ### Greater Than Operator (`>`) -Checks if the left hand side operand is larger than the right hand side operand. +Checks if the left-hand side operand is larger than the right-hand side operand. ```python print(1 > 2) @@ -55,11 +55,11 @@ print(3.2 > 9) Running this will give us the following output: ```text False True False ``` This reads almost like plain English! 1 is not greater than 2, hence it returns `False` and prints -it out. 20 is larger than 1, which results the output being `True`, and so on. +it out. 20 is larger than 1, which results in `True` being the output, and so on. ### Less Than Operator (`<`) -Checks if the right hand side operand is larger than the left hand side operand. +Checks if the right-hand side operand is larger than the left-hand side operand. ```python print(3 < 9) @@ -77,7 +77,7 @@ False ### Equal To Operator (`==`) -Checks if both left and right hand side operands are exactly equal. +Checks if both left and right-hand side operands are exactly equal. ```python print(123 == 321) @@ -119,7 +119,7 @@ True ### Greater Than Or Equal To Operator (`>=`) -Checks if the left hand side operand is either greater than or equal to the right hand side operand. +Checks if the left-hand side operand is either greater than or equal to the right-hand side operand. ```python print(90 >= 18) @@ -140,7 +140,7 @@ to 23 which also gives us `True` as the output. ### Less Than Or Equal To Operator (`<=`) -Checks if the right hand side operand is either greater than or equal to the left hand side operand. +Checks if the right-hand side operand is either greater than or equal to the left-hand side operand. ```python print(4 <= 18) @@ -284,13 +284,34 @@ minutes = 150 print(minutes // 60) ``` +Output: + ```text 2 ``` +??? note "Floor division and negative numbers" + + Floor division always rounds **down**, toward negative infinity. With positive numbers this looks + like the decimal part is simply cut off, but with negative numbers it behaves differently: + + ```python + print(7 // 2) + print(-7 // 2) + ``` + + Output: + + ```text + 3 + -4 + ``` + + `-7 / 2` is `-3.5`. Rounding down means moving to the next smaller number, which is `-4`, not `-3`. + ### Modulus -The modulus operator (`%`) gives us the **remainder** left over after a division. Remember long +The modulus operator (`%`) gives us the **remainder** left over after division. Remember long division from school? `7 ÷ 2` is `3` with a remainder of `1`, so `7 % 2` is `1`: ```python