summaryrefslogtreecommitdiff
path: root/tutorials/3.1_basics_of_python.md
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2025-01-29 00:17:37 -0700
committerChristian Kolset <christian.kolset@gmail.com>2025-01-29 00:17:37 -0700
commitbf57cd5d36abafcc0737ed5639b410945f7537e3 (patch)
treec4328f63298a124179dce5ba97ea13bc46819bf4 /tutorials/3.1_basics_of_python.md
parentb07843bb17595bbfbe43becc899fcae7a382b338 (diff)
Updated index for 3.1 basics of python and the table of content in tutorial/read.me
Diffstat (limited to 'tutorials/3.1_basics_of_python.md')
-rw-r--r--tutorials/3.1_basics_of_python.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/tutorials/3.1_basics_of_python.md b/tutorials/3.1_basics_of_python.md
new file mode 100644
index 0000000..12762cd
--- /dev/null
+++ b/tutorials/3.1_basics_of_python.md
@@ -0,0 +1,80 @@
+# Basics of Python
+This page contains important fundamental concepts used in Python such as syntax, operators, order or precedence and more.
+
+## Syntax
+In python *indentations* or the space at the start of each line, signifies a block of code. This becomes important when we start working with function and loops.
+
+## Operators
+### Arithmetic operators
+| Operator | Name |
+| --- | --- |
+| + | Addition |
+| - | Subtraction |
+| * | Multiplication |
+| / | Division |
+| % | Modulus |
+| ** | Exponentiation |
+| // | Floor division |
+
+
+### Comparison operators
+| Operator | Name |
+| --- | --- |
+| == | Equal |
+| != | Not equal |
+| > | Greater than |
+| < | Less than |
+| >= | Greater than or equal to |
+| <= | Less than or equal to |
+
+### Logical operators
+| Operator | Descrription |
+| --- | --- |
+| and | Returns True if both statemetns are true |
+| or | Returns True if one of the statements is true |
+| not | Reerse the result, returns False if the result is true |
+
+### Identity operators
+| Operator | Description |
+| --- | --- |
+| is | Returns True if both variables are the same object |
+| is not | Returns True if both variables are not the same object |
+
+## Order of Operation
+| Operator | Description |
+| --- | --- |
+| () | Parentheses |
+| ** | Exponentiation |
+| * / // % | Multiplication, Division, floor division, and modulus |
+| & | AND |
+| ^ | XOR |
+| \| | OR |
+| == | Comparision, identity and membership operators |
+| not | logical NOT |
+| and | AND |
+| or | OR |
+
+## Comments
+Comments can be added to your code using the hash operator (#). Any text behind the comment operator till the end of the line will be rendered as a comment.
+
+## Data types
+Data types are different ways a computer stores data. Other data types use fewer bits than others allowing you to better utilize your computer memory. This is important for engineers because
+The most common data types that an engineer encounters in python are numeric types.
+- 'int' - integer
+- 'float' - a decimal number
+- 'complex' - imaginary number
+
+
+The comprehensive table below show all built-in data types available in python.
+
+
+
+| Category | Data Type |
+| ---------- | ------------------------- |
+| Text | int, float, complex |
+| Sequance | list, tuple, range |
+| Mapping | dict |
+| Set | set, frozenset |
+| Boolean | bytes, bytearray, memoryview |
+| Binary | bytes, bytearray, memoryview |
+| None | NoneType |