搜尋此網誌

2026年6月11日星期四

Similar pronunciation

incense

  • IPA[ɪnˈsens]

insane

IPA[ɪnˈseɪn]

Similar words

shawl IPA[ʃɔːl]

披肩

scarf IPA[skɑːf]

圍巾

A scarf (圍巾) is usually long and narrow, worn around the neck for warmth or style, while a shawl (披肩) is larger and wider, draped over the shoulders or upper body for coverage and elegance.

Microsoft Copilot

2026年6月10日星期三

Chapter Quiz

In Python, a defaultdict is a special kind of dictionary from the collections module. Its main advantage is that it automatically provides a default value for any key that doesn’t exist yet, instead of raising a KeyError.

You create it by passing in a default factory function (like int, list, or set).

When you access a missing key, defaultdict calls that factory to create a default value and stores it under that key.

In Python, the get() function is a method of dictionaries. It’s used to safely retrieve the value for a given key without risking a KeyError if the key doesn’t exist.


In Python, a set is a built‑in data type that represents an unordered collection of unique elements. Think of it like a mathematical set: no duplicates, and order doesn’t matter.

Unique elements only → duplicates are automatically removed.

Unordered → items don’t have a fixed position or index.

Mutable → you can add or remove elements.

Fast membership tests → checking if something is in a set is very efficient.

# Using curly braces fruits = {"apple", "banana", "cherry"} # Using the set() constructor numbers = set([1, 2, 2, 3]) print(numbers) # {1, 2, 3} (duplicates removed)


In Python, item[1:3] is an example of list slicing (or sequence slicing).

item is assumed to be a list (or another sequence like a string or tuple).

[1:3] means:

    Start at index 1 (the second element, since Python uses zero‑based indexing).

    Stop before index 3 (so it includes elements at positions 1 and 2, but not 3).

In Python, item[1:] is another example of slicing.

1: means start at index 1 (the second element, since indexing starts at 0).

The colon without an end index means go all the way to the end.

So item[1:] returns everything from index 1 onward.


A nested list comprehension in Python is simply a list comprehension inside another one. It’s often used to flatten lists, generate combinations, or apply transformations across multiple levels of data.

[expression for outer in iterable1 for inner in iterable2]

The outer loop runs first, then the inner loop.

You can nest more than two loops if needed.

To apply a function someFunc to all comments in a list of blog objects using a nested list comprehension

[[someFunc(comment) for comment in blog.comments] for blog in blogs]

Outer loopfor blog in blogs → iterate through each blog object.

Inner loopfor comment in blog.comments → iterate through each comment in that blog.

ExpressionsomeFunc(comment) → apply your function to each comment.

Result → a list of lists, where each inner list contains the processed comments for one blog.

def someFunc(text): return text.upper() class Blog: def __init__(self, comments): self.comments = comments blogs = [ Blog(["Nice post!", "Great read"]), Blog(["Interesting idea", "Could be improved"]), Blog(["Loved it", "Thanks for sharing"]) ] processed = [[someFunc(comment) for comment in blog.comments] for blog in blogs] print(processed)

Result:
[['NICE POST!', 'GREAT READ'], ['INTERESTING IDEA', 'COULD BE IMPROVED'], ['LOVED IT', 'THANKS FOR SHARING']]

  • __init__ → the special method that runs automatically when you create a new object from the class.

  • self → refers to the new object being created.

  • comments → a parameter you pass in when creating the object.

  • self.comments = comments → stores the passed‑in value as an attribute of the object, so you can access it later.

class Blog: def __init__(self, comments): self.comments = comments # Create a Blog object with a list of comments blog1 = Blog(["Nice post!", "Great read"]) print(blog1.comments) # ['Nice post!', 'Great read']

  • When you call Blog(["Nice post!", "Great read"]), Python automatically calls __init__.

  • The comments list is passed in and stored as self.comments.

  • Now the object blog1 has an attribute comments you can use anywhere.


list(range(101))[::5]

range(101) → generates numbers from 0 up to 100 (inclusive).

So list(range(101)) = [0, 1, 2, 3, ..., 100].

[::5] → slice syntax with:

start = empty → defaults to beginning (0).

stop = empty → defaults to end (100).

step = 5 → take every 5th element.

Result → all multiples of 5 between 0 and 100.


list(range(101))[::-5]

Step 1: Build the list

list(range(101)) → [0, 1, 2, 3, ..., 100]

Step 2: Understand the slice

The slice is [::-5], which means:

start → empty → defaults to the end of the list.

stop → empty → defaults to the beginning.

step = -5 → move backwards, taking every 5th element.


Microsoft Copilot

Cons of social media

William James said, "Our life experience will equal what we have paid attention to, whether by choice or by default."

我們的人生經驗,將等同於我們所注意到的事物,無論是出於選擇還是無意之中。

我們所注意到的事物不只是外在事件,也包括我們的想法、情緒、人際互動、習慣與重複的觀察。換句話說,注意力決定了哪些事物被放大、被記住、被內化。

如果你經常刻意練習感恩、關注身邊的美好,你的生活經驗會偏向正面與滿足。如果你習慣性地沉迷於負面新聞或無止境的社群媒體滾動,即使沒有刻意選擇,你的人生感受也會變得焦慮或空虛。

注意力就是資源:有意識地選擇把注意力放在哪裡,就能改變你未來的回憶與感受。
管理環境與習慣:減少無意的干擾,建立有意的練習(如專注、閱讀、深度交流),能讓人生經驗更符合你想要的樣子。

Microsoft Copilot

Nicole Vignola "Rewire"

Part II of Python Test

def decodeString(encodedList):
    decodedStr = ''
    for item in encodedList:
        decodedStr = decodedStr + item[0] * item[1]
    return decodedStr

1. Start with an empty string: decodedStr = ''

2. Loop through each (char, count) tuple in encodedList.

3. Multiply the character by its count:

item[0] * item[1]

Example: 'a' * 3 → "aaa".

4. Concatenate to decodedStr.

5. Return the final reconstructed string.

Microsoft Copilot

Be water

如水柔順,如水堅強,方可如水無孔不入、無堅不摧。

在人際關係中,要懂得柔軟、包容。

在挑戰困境時,要保持堅毅、持續。

在策略上,要懂得靈活變通,找到突破口。

Boss without insight

outlier: a person or thing that is different from or in a position away from others in the group

brim: to be full of something

underscore: ​to emphasize or show that something is important or true

chalk up: ​(informal) to achieve or record a success, points in a game, etc.

to trip over something: to fall over, to stumble on, to slip on something

spill out: ​to tell somebody all about a problem etc. very quickly; to come out quickly

goad: ​to keep annoying somebody/something until they react

scrap something: to cancel or get rid of something that is no longer practical or useful

cotton candy: ​a type of sweet in the form of a mass of sticky threads made from melted sugar and served on a stick, especially at fairgrounds

if a computer crashes or you crash a computer, it stops working suddenly

spawn: to cause something to develop or be produced

rightfully: according to the law or to what is right or correct

flawed: having a flaw; not perfect or correct

horde: a large crowd of people

boomerang: if a plan boomerangs on somebody, it hurts them instead of the person it was intended to hurt

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com