8000 Update for section 2 · VixyMan/complete-python-course@543c1c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 543c1c7

Browse files
committed
Update for section 2
1 parent c753498 commit 543c1c7

File tree

2 files changed

+53
-43
lines changed

2 files changed

+53
-43
lines changed

course_contents/1_intro/README.md

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,7 @@
1-
## Basic Data Types
2-
### Variable `x`
3-
### String `"My string"`
4-
### Integer `10`
5-
### Float `15.95`
6-
### Bool `True/False`
7-
### List `[]`
8-
### Tuple `(,)`
9-
### Set `{}`
10-
### Dictionary `{:}`
1+
# 01. Basic Data Types
112

12-
## Arithmetic Operators
13-
### Addition `+`
14-
### Subtraction `-`
15-
### Multiplication `*`
16-
### True Division `/`
17-
### Floor Division `//`
18-
### Modulo `%`
19-
### Exponentiation `**`
3+
# 02. Arithmetic Operators
204

21-
## Comparison Operators
22-
### Equal `==`
23-
### Not equal `!=`
24-
### Greater than `>`
25-
### Less than `<`
26-
### Greater than or equal to `>=`
27-
### Less than or equal to `<=`
5+
# 03. Comparison Operators
286

29-
## Logical Operators
30-
### AND
31-
### OR
32-
### NOT
33-
34-
## Operator precedence
35-
Showing from most binding to the least binding
36-
- Parentheses (grouping)
37-
- Exponentiation
38-
- Multiplication, division, modulo
39-
- Addition, subtraction
7+
# 04. Logical Operators
Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,49 @@
1-
### Addition `+`
2-
### Subtraction `-`
3-
### Multiplication `*`
4-
### True Division `/`
5-
### Floor Division `//`
6-
### Modulo `%`
7-
### Exponentiation `**`
1+
## Addition `+`
2+
Correct uses:
3+
- The use with integers and floats:
4+
`44 + 19.5 # 63.5`
5+
- The use with strings (concatenation):
6+
`"My name is" + "James"`
7+
8+
Wrong uses:
9+
- Between strings and integers/floats:
10+
`"The correct number is" + 5`
11+
`TypeError: can only concatenate str (not "int") to str`
12+
13+
## Subtraction `-`
14+
- The use between integers/floats:
15+
`93.1 - 50`
16+
17+
## Multiplication `*`
18+
- The arithmetic use:
19+
`8 * 5`
20+
21+
- Multiplying data types:
22+
`"Hello " * 2`
23+
`[100] * 2`
24+
`(100, 1) * 2`
25+
26+
## True Division `/`
27+
- The two operands will always result in a float using the `/` operator
28+
29+
Example:
30+
`40 / 2` will result `20.0`
31+
32+
## Floor Division `//`
33+
- Will always round the amount and result in a string
34+
35+
Example:
36+
`55 // 3`
37+
38+
## Modulo `%`
39+
- Based on the Euclidean division
40+
- Start with a **dividend** and a **divisor**
41+
- It's used to get the remainder between the two operands
42+
43+
Example:
44+
45+
The result for `10 % 3` is `1`.
46+
47+
48+
## Exponentiation `**`
49+
`2 ** 3` Can be read as: 2 raised to the power of 3, and it works just like in math

0 commit comments

Comments
 (0)
0