Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct some mistakes and add some features #628

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 03_Day_Operators/03_operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ print('Division: ', 7 / 2) # 3.5
print('Division without the remainder: ', 7 // 2) # 3, gives without the floating number or without the remaining
print ('Division without the remainder: ',7 // 3) # 2
print('Modulus: ', 3 % 2) # 1, Gives the remainder
print('Exponentiation: ', 2 ** 3) # 9 it means 2 * 2 * 2
print('Exponentiation: ', 2 ** 3) # 8 it means 2 * 2 * 2
```

**Example:Floats**
Expand Down
2 changes: 1 addition & 1 deletion 03_Day_Operators/day-3.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
print('Division without the remainder: ', 7 // 2) # gives without the floating number or without the remaining
print('Modulus: ', 3 % 2) # Gives the remainder
print ('Division without the remainder: ', 7 // 3)
print('Exponential: ', 3 ** 2) # it means 3 * 3
print('Exponential: ', 2 ** 3) # 8 it means 2 * 2 * 2

# Floating numbers
print('Floating Number,PI', 3.14)
Expand Down
22 changes: 14 additions & 8 deletions 07_Day_Sets/07_sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ fruits = set(fruits) # {'mango', 'lemon', 'banana', 'orange'}

### Joining Sets

We can join two sets using the _union()_ or _update()_ method.
We can join two sets using the _union()_ or _update()_ method or _|_ symbol .

- Union
This method returns a new set
Expand All @@ -235,7 +235,7 @@ We can join two sets using the _union()_ or _update()_ method.
# syntax
st1 = {'item1', 'item2', 'item3', 'item4'}
st2 = {'item5', 'item6', 'item7', 'item8'}
st3 = st1.union(st2)
st3 = st1.union(st2) #st3 = st1 | st2
```

**Example:**
Expand All @@ -244,6 +244,7 @@ st3 = st1.union(st2)
fruits = {'banana', 'orange', 'mango', 'lemon'}
vegetables = {'tomato', 'potato', 'cabbage','onion', 'carrot'}
print(fruits.union(vegetables)) # {'lemon', 'carrot', 'tomato', 'banana', 'mango', 'orange', 'cabbage', 'potato', 'onion'}
# or using this : print(fruits | vegetables)
```

- Update
Expand All @@ -267,13 +268,14 @@ print(fruits) # {'lemon', 'carrot', 'tomato', 'banana', 'mango', 'orange', 'cabb

### Finding Intersection Items

Intersection returns a set of items which are in both the sets. See the example
Intersection returns a set of items which are in both the sets or using _&_ symbol. See the example

```py
# syntax
st1 = {'item1', 'item2', 'item3', 'item4'}
st2 = {'item3', 'item2'}
st1.intersection(st2) # {'item3', 'item2'}
# or using thia : st1 & st2
```

**Example:**
Expand All @@ -286,6 +288,7 @@ whole_numbers.intersection(even_numbers) # {0, 2, 4, 6, 8, 10}
python = {'p', 'y', 't', 'h', 'o','n'}
dragon = {'d', 'r', 'a', 'g', 'o','n'}
python.intersection(dragon) # {'o', 'n'}
# python & dragon
```

### Checking Subset and Super Set
Expand Down Expand Up @@ -318,14 +321,14 @@ python.issubset(dragon) # False

### Checking the Difference Between Two Sets

It returns the difference between two sets.
It returns the difference between two sets or using _-_ symbol .

```py
# syntax
st1 = {'item1', 'item2', 'item3', 'item4'}
st2 = {'item2', 'item3'}
st2.difference(st1) # set()
st1.difference(st2) # {'item1', 'item4'} => st1\st2
st2.difference(st1) # set() : st2 - st1
st1.difference(st2) # {'item1', 'item4'} => st1\st2 : st2 - st1
```

**Example:**
Expand All @@ -338,19 +341,21 @@ whole_numbers.difference(even_numbers) # {1, 3, 5, 7, 9}
python = {'p', 'y', 't', 'o','n'}
dragon = {'d', 'r', 'a', 'g', 'o','n'}
python.difference(dragon) # {'p', 'y', 't'} - the result is unordered (characteristic of sets)
# python - dragon
dragon.difference(python) # {'d', 'r', 'a', 'g'}
# dragon - python
```

### Finding Symmetric Difference Between Two Sets

It returns the symmetric difference between two sets. It means that it returns a set that contains all items from both sets, except items that are present in both sets, mathematically: (A\B) ∪ (B\A)
It returns the symmetric difference between two sets. It means that it returns a set that contains all items from both sets, except items that are present in both sets, mathematically: (A\B) ∪ (B\A) or using _^_ symbol

```py
# syntax
st1 = {'item1', 'item2', 'item3', 'item4'}
st2 = {'item2', 'item3'}
# it means (A\B)∪(B\A)
st2.symmetric_difference(st1) # {'item1', 'item4'}
st2.symmetric_difference(st1) # {'item1', 'item4'} : st2 ^ st1
```

**Example:**
Expand All @@ -363,6 +368,7 @@ whole_numbers.symmetric_difference(some_numbers) # {0, 6, 7, 8, 9, 10}
python = {'p', 'y', 't', 'h', 'o','n'}
dragon = {'d', 'r', 'a', 'g', 'o','n'}
python.symmetric_difference(dragon) # {'r', 't', 'p', 'y', 'g', 'a', 'd', 'h'}
# python ^ dragon
```

### Joining Sets
Expand Down
4 changes: 4 additions & 0 deletions 10_Day_Loops/10_loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ lst = list(range(0,11,2))
print(lst) # [0, 2, 4, 6, 8, 10]
st = set(range(0,11,2))
print(st) # {0, 2, 4, 6, 8, 10}

# for backward from start to end
lst = list(range(11,0,-2))
print(lst) # [11,9,7,5,3,1]
```

```py
Expand Down
2 changes: 1 addition & 1 deletion 11_Day_Functions/11_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def square_number (n):
return n * n
def do_something(f, x):
return f(x)
print(do_something(square_number, 3)) # 27
print(do_something(square_number, 3)) # 9
```

🌕 You achieved quite a lot so far. Keep going! You have just completed day 11 challenges and you are 11 steps a head in to your way to greatness. Now do some exercises for your brain and muscles.
Expand Down