You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/30DaysOfPython/2025-12-18-python-day6.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,9 @@ var_b = tuple() # This also creates one using a function.
34
34
35
35
I've explained that with tuples being immutable, we have many functions that we aren't able to do. So, for the latter part of this post I'll be writing functions that are used to access or check the information displayed within a tuple.
36
36
37
+
<!-- prettier-ignore -->
37
38
> Tip: You _can_ change a tuple to another collection data type like list, then modify it, and then change the new list with modified items in to a tuple.
> **Note**: `difference()` uses one set against another to compare, whereas `symmetric_difference()` uses both to compare and returns items that are unique in each set.
170
-
> {: .prompt-tip}
172
+
{: .prompt-tip}
171
173
172
174
We can also use `isdisjoint()` to provide a boolean response to see if two sets contain similar items. If they do then we can't join them, if they don't we can.
Copy file name to clipboardExpand all lines: _posts/30DaysOfPython/2025-12-18-python-day8.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
layout: post
3
3
title: Dictionaries - Storing Data Like a Database, Right In Python...
4
4
description: >-
5
-
While the title of this blog implies that a dictionary list in Python is a database, it's not. How it works, however, is very close to that of a database. Each entry stored has its own 'Key':'Value'. The key to each value is used to perform functions, replacing the need for indices. Here's what I've learnt about dictionaries on Day 8.
5
+
While the title of this blog implies that a dictionary list in Python is a database, it's not. How it works, however, is very close to that of a database. Each entry stored has its own 'Key':'Value'. The key to each value is used to perform functions, replacing the need for indices. Here's what I've learnt about dictionaries on Day 8.
Copy file name to clipboardExpand all lines: _posts/30DaysOfPython/2025-12-20-python-day2.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,9 @@ When creating a variable, we would use a principle to follow that helps create a
32
32
33
33
By now we should have already gone over how to load a development environment on your device to start coding with Python.
34
34
35
+
<!-- prettier-ignore -->
35
36
> If you haven't yet installed both Python and VSCode, read this post: [Introduction To Python](https://sheikh-h.github.io/Blog/posts/python-day1/)
36
-
> {: .prompt-info }
37
+
{: .prompt-info }
37
38
38
39
I'll use actual code examples to show you how you can;
39
40
@@ -62,13 +63,15 @@ Here is a comprehensive guideline to creating a Python Variable with the right n
62
63
-**Can** be alpha-numeric (letters & numbers) and have underscores
63
64
- Should represent or be named something **relative** to the **information stored**.
64
65
66
+
<!-- prettier-ignore -->
65
67
> Valid uses:
66
68
67
69
- num_1
68
70
- Num_1
69
71
- nuM_1
70
72
{: .prompt-tip }
71
73
74
+
<!-- prettier-ignore -->
72
75
> Invalid uses:
73
76
74
77
- 1_num
@@ -80,8 +83,9 @@ The naming convention we've used here is recognised as 'snake case'. This is the
80
83
81
84
Another convention we _could_ use is called 'Camel Case', where we would capitalise the first character of each word and join them using underscores like `Camel_Case`.
82
85
86
+
<!-- prettier-ignore -->
83
87
> **Note**: When it comes to creating variables, always keep in mind of the _built-in_ functions we have access to in Python as these also use 'reserved' words. It just means that using an existing functions name as a variable could cause errors throughout your program. Try be as unique as possible for all variable names.
84
-
> {: .prompt-warning}
88
+
{: .prompt-warning}
85
89
86
90
## Performing Functions
87
91
@@ -168,8 +172,9 @@ print(is_light_on)
168
172
-**Lists**
169
173
- Lists are exactly as described, they are a list of data types that you can store. There are 4 collection types that you can have; Lists, Sets, Tuples, and Dictionaries. We'll be learning about lists, I believe on **Day 5**.
170
174
175
+
<!-- prettier-ignore -->
171
176
> A concept called **List Comprehension** is explained in **Day 13** of the course I am using, which will further dissect the lists topic/module.
172
-
> {: .prompt-tip}
177
+
{: .prompt-tip}
173
178
174
179
## Using Different Data Types
175
180
@@ -222,8 +227,9 @@ address = {
222
227
223
228
```
224
229
230
+
<!-- prettier-ignore -->
225
231
> You can go on ahead and do the same on your own Python script and play around with some of the data types. Try making your own or use different data types for each!
226
-
> {: .prompt-tip}
232
+
{: .prompt-tip}
227
233
228
234
Let's now go on ahead and start using a function with these variables we have created. The function we will use is `type()` which brings back the data type of the information stored in that variable.
229
235
@@ -264,8 +270,9 @@ Similar to primitive data types, Python has a large library of built-in function
264
270
265
271
By this point, I would say it's not imperative that we learn all the functions there are. However, it's a good idea to get a feel of what we have access to and what some of them do.
266
272
273
+
<!-- prettier-ignore -->
267
274
> Visit 👉 [Python's Builtin Functions Documentation](https://docs.python.org/3.9/library/functions.html) to get a list of all the functions
_Image source: [30 Days Of Python: Day 2](https://github.com/Asabeneh/30-Days-Of-Python/blob/master/02_Day_Variables_builtin_functions/02_variables_builtin_functions.md)_
Copy file name to clipboardExpand all lines: _posts/30DaysOfPython/2025-12-21-python-day3.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,8 +185,9 @@ From that example, we are able to see how we can create conditions using IF Stat
185
185
186
186
While reviewing the course content and external sources, I came across operator types that weren’t heavily emphasised in the exercises. Even though they’re more niche, I wanted to include them here so my notes stay complete[^f2].
187
187
188
+
<!-- prettier-ignore -->
188
189
> This is a complete guide to use or resource I would read over - [Python Identity Operators](https://www.w3schools.com/python/python_operators.asp)
189
-
> {: .prompt-tip}
190
+
{: .prompt-tip}
190
191
191
192
### Bitwise (Binary) Assignment Operators
192
193
@@ -275,8 +276,9 @@ print(x is y) # False
275
276
print(x == y) # True
276
277
```
277
278
279
+
<!-- prettier-ignore -->
278
280
> **Update**: I have recently learnt about **constant** and **runtime** sequences which explain that any sequential data, like strings, created _before_ runtime get stored in the same memory location for as long as the data inside are identical. Therefore, if you where to use the identity operator on these variables it would bring back a `True` statement.
Copy file name to clipboardExpand all lines: _posts/30DaysOfPython/2025-12-21-python-day4.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,8 +51,9 @@ of code'''
51
51
52
52
Before I begin here, I would like to add that there are many built-in functions that Python has and I have discussed this in one of my earlier posts - _[Variables, Built-in Functions, and Data Types in Python](https://sheikh-h.github.io/Blog/posts/python-day2/)_.
53
53
54
+
<!-- prettier-ignore -->
54
55
> Here is the official link from Python for built-in functions [Python Documentation - Built-In Functions](https://docs.python.org/3/library/functions.html)!
55
-
> {: .prompt-tip}
56
+
{: .prompt-tip}
56
57
57
58
```python
58
59
var_a ="My name is Sheikh Hussain"
@@ -82,8 +83,9 @@ print(full_name)
82
83
83
84
Remember:
84
85
86
+
<!-- prettier-ignore -->
85
87
> Using the `+` doesn't _add_ strings together, it creates a new string and presents that to you. The original variable stays the same.
86
-
> {: .prompt-tip}
88
+
{: .prompt-tip}
87
89
88
90
---
89
91
@@ -125,8 +127,9 @@ There are several different types of escape functions that we can use and here i
> This is a comprehensive list created with AI, I would say only 1/3 of them you'll want to really use. - It's just good to know.
129
-
> {: .prompt-info}
132
+
{: .prompt-info}
130
133
131
134
---
132
135
@@ -249,8 +252,9 @@ print(word[-1]) # g
249
252
250
253
You can access items either using positive or negative numbers.
251
254
255
+
<!-- prettier-ignore -->
252
256
> Positive numbers will start from `0` and work to the last item in the variable, negative numbers will start at `-1` then work towards the beginning of the variable.
253
-
> {: .prompt-tip}
257
+
{: .prompt-tip}
254
258
255
259
---
256
260
@@ -282,8 +286,9 @@ Using this notation, you can select a portion of a sequence (like a string or li
282
286
283
287
- Step/Skip tells Python how many items to skip each time and select the index it lands on
284
288
289
+
<!-- prettier-ignore -->
285
290
> **Tip**: If you leave start or stop empty, Python will automatically use the beginning or end of the sequence.
> **Note**: When we use the term _ordered_ for lists, we mean _preserving_ the order in which items were inserted - **not logical ordering**. Lists, Tuples, and Dictionaries **preserve** insertion order. In contrast, _Sets_ are unordered, hence if you were to create a set with items in, with each run of the program, you could see the items shift.
> **List Concatenation** is an operation that produces a _new list_ by combining the items from other lists.
103
-
> {: .prompt-tip}
105
+
{: .prompt-tip}
104
106
105
107
We can also use advanced functions like `for loops` to add items into a list using a loop function, with each iteration of the loop an item from a list gets added.
106
108
@@ -247,8 +249,9 @@ print("Cat" in lst) # True
247
249
print("Lion"in lst) # False
248
250
```
249
251
252
+
<!-- prettier-ignore -->
250
253
> I want to recall a construct that I mentioned before while discussing operators, _constant and runtime sequences_[^f3]. Lists, though sequential, are mutable and therefore identical lists do not get stored in the same location.
251
-
> {: .prompt-tip}
254
+
{: .prompt-tip}
252
255
253
256
## Finding The Index Of An Item
254
257
@@ -280,8 +283,9 @@ print(d) # ["Item4", "Item5"]
280
283
281
284
The `*variable =` assignment operator produces a new list with the _rest_ of the items in the list you specify.
282
285
286
+
<!-- prettier-ignore -->
283
287
> **Hint**: With extended iterable unpacking, you can assign some items to individual variables and use a starred variable (\*variable) to collect the remaining items. You can place the starred variable at the start, middle, or end, but you can only have one starred variable.
284
-
> {: .prompt-tip}
288
+
{: .prompt-tip}
285
289
286
290
## Copying Lists
287
291
@@ -342,8 +346,9 @@ lst.reverse()
342
346
print(lst) # ["Item 3", "Item 1", "Item 2"]
343
347
```
344
348
345
-
> Note how this just printed it all out in reverse rather than ordering.
346
-
> {: .prompt-info}
349
+
<!-- prettier-ignore -->
350
+
> **Note**: how this just printed it all out in reverse rather than ordering.
0 commit comments