diff options
| -rw-r--r-- | tutorials/3.1_basics_of_python.md | 80 | ||||
| -rw-r--r-- | tutorials/basics_of_python.md | 1 | ||||
| -rw-r--r-- | tutorials/readme.md | 5 |
3 files changed, 83 insertions, 3 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 | diff --git a/tutorials/basics_of_python.md b/tutorials/basics_of_python.md deleted file mode 100644 index e219e92..0000000 --- a/tutorials/basics_of_python.md +++ /dev/null @@ -1 +0,0 @@ -# Basics of Python diff --git a/tutorials/readme.md b/tutorials/readme.md index 5570cdd..2ce7570 100644 --- a/tutorials/readme.md +++ b/tutorials/readme.md @@ -10,7 +10,8 @@ This directory contains all the tutorials. - Package Management - [1.3 version_control.md](1.3_version_control.md) -### 2.0 Computing fundamentals +### 2.0 Spyder +- [2.1 Getting started with Spyder](2.1_spyder_getting_started.md) - Computing Terminology and Orientation? - Working with computers - Command window, terminal, console, command prompt. @@ -18,7 +19,7 @@ This directory contains all the tutorials. - Scripting ### 3.0 Programing in Python -- [basics_of_python.md](basics_of_python.md) +- [3.1 basics_of_python.md](3.1_basics_of_python.md) - Syntax - Operators - Comments |
