mirror of
https://github.com/Asabeneh/30-Days-Of-Python.git
synced 2026-06-03 21:02:42 +08:00
Merge pull request #191 from kunal254/patch-1
Minor bug fixes and typos.
This commit is contained in:
commit
4d7f24bbb7
@ -403,7 +403,7 @@ Generally avoid this unless required as it makes it harder to understand what th
|
||||
```py
|
||||
#You can pass functions around as parameters
|
||||
def square_number (n):
|
||||
return n * n
|
||||
return n ** n
|
||||
def do_something(f, x):
|
||||
return f(x)
|
||||
print(do_something(square_number, 3)) # 9
|
||||
|
||||
@ -92,7 +92,7 @@ numbers = [-8, -7, -3, -1, 0, 1, 3, 4, 5, 7, 6, 8, 10]
|
||||
positive_even_numbers = [i for i in numbers if i % 2 == 0 and i > 0]
|
||||
print(positive_even_numbers) # [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
|
||||
|
||||
# Flattening a three dimensional array
|
||||
# Flattening a two dimensional array
|
||||
list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
||||
flattened_list = [ number for row in list_of_lists for number in row]
|
||||
print(flattened_list) # [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
@ -348,7 +348,7 @@ ZeroDivisionError: division by zero
|
||||
We cannot divide a number by zero.
|
||||
|
||||
We have covered some of the python error types, if you want to check more about it check the python documentation about python error types.
|
||||
If you are good at reading the error types then you will be able to fix your bugs fast and you will also become a better programmer.
|
||||
If you are good at reading the error types, then you will be able to fix your bugs fast and you will also become a better programmer.
|
||||
|
||||
🌕 You are excelling. You made it to half way to your way to greatness. Now do some exercises for your brain and for your muscle.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user