搜尋此網誌

2026年9月3日星期四

quiz

def triangle(num):

    if num == 1:

        return num

    return num + triangle(num - 1)

Your function triangle(num) is a recursive way to calculate the triangular number — the sum of all integers from 1 up to num.

How it works

  • Base case: If num == 1, it returns 1.

  • Recursive case: Otherwise, it returns num + triangle(num - 1), which keeps calling itself until it reaches 1.

So for triangle(4):

  • 4 + triangle(3)

  • 4 + (3 + triangle(2))

  • 4 + (3 + (2 + triangle(1)))

  • 4 + 3 + 2 + 1 = 10

Key points

  • It computes the sum 1+2++n.

  • This is known as the n-th triangular number.

  • Formula: n(n+1)2

小學奧數口訣︰頭項加尾項乘項數除二

def square(num):

    return triangle(num-1) + triangle(num)


Explanation

  • triangle(n) gives the sum of integers from 1 to n. Example: triangle(4) = 1+2+3+4 = 10.

  • In your square(num) function, you’re adding:

    • triangle(num-1) → sum of numbers up to num-1

    • triangle(num) → sum of numbers up to num

If num = 4
square(4) = 16
triangle(3) + tringle(4) = 6 + 10 = 16


Microsoft Copilot

強化與減弱

dwell on: to think or talk a lot about something, especially something it would be better to forget

reframe: to frame (something) again and often in a different way

indicative: a form in the indicative mood

Long-term potentiation (LTP) is a long-lasting increase in the strength of synaptic connections between neurons, triggered by repeated or high-frequency stimulation.

Long-term depression (LTD) in neuroscience is an activity-dependent reduction in the strength of neuronal synapses that lasts for hours or longer.

Opposite of LTP: While long-term potentiation (LTP) strengthens connections, LTD weakens them to balance brain activity and clear space for new information.

LTP 與 LTD 共同構成神經可塑性的雙向調節,支援 Hebbian 學習與記憶的形成與修正。它們也出現在時序依賴性突觸可塑性(Spike-timing-dependent plasticity, STDP)中,依據前後脈衝時差決定增強或抑制。總體上,LTP 強化有用的連結,LTD 削弱冗餘或錯誤的連結,維持網路穩定與資訊儲存效率。

Hebbian theory states that connections between neurons strengthen when they are activated repeatedly at the same time. Often summarized by the phrase: "Neurons that fire together, wire together".

substitute: to take the place of somebody/something else; to use somebody/something instead of somebody/something else

sever: to cut something into two pieces; to cut something off something

dismantle: to take apart a machine or structure so that it is in separate pieces

Nicole Vignola "Rewire"

hk.dictionary.search.yahoo.com

oxfordlearnersdictionaries.com

www.merriam-webster.com

Google AI overview

Explained by Microsoft Copilot

2026年8月27日星期四

Negativity Bias

lard: a solid white substance made from the melted fat of pigs that is used in cooking

recount: to tell somebody about something, especially something that you have experienced

malevolent: having or showing a desire to harm other people

melodramatic: full of exciting and extreme emotions or events; behaving or reacting to something in an exaggerated way

embellish: embellish something to make something more beautiful by adding decoration to it

piss somebody off: to make somebody annoyed or bored

gloom and doom: a general feeling of having lost all hope, and of pessimism (= expecting things to go badly)

gleaming: shining brightly because of being very clean

conspire: to secretly plan with other people to do something illegal or harmful

dwell on: to think or talk a lot about something, especially something it would be better to forget

ruin: to damage something so badly that it loses all its value, pleasure, etc.

The science of negativity bias concludes that when there are equal measures of good and bad emotions, the psychological effects of the bad ones outweigh the good ones.

For example, if you receive a bunch of great comments on your social media post but one negative one, you are more likely to dwell on the negative comment for the rest of your day or week.

負面偏見指心理學發現:當好壞情緒同等時,負面情緒的影響力更大,比正面情緒更容易被記住和放大。這會讓人對壞的事反應更強烈、花更多時間思考或擔憂。

例如在社群貼文中,即使收到很多正面留言,一則負評也更可能佔據你的注意力,讓你整天或好幾天都反覆想起那條負評。

attuned (to somebody/something) familiar with somebody/something so that you can understand or recognize them or it and act in an appropriate way

gratitude: the feeling of being grateful and wanting to express your thanks

The most detrimental part about this negativity bias is that we all have a narrative that we repeat, a story that we tell ourselves and others about ourselves.

detrimental: harmful

perpetuate: to make something such as a bad situation, a belief, etc. continue for a long time

Nicole Vignola "Rewire"

hk.dictionary.search.yahoo.com

oxfordlearnersdictionaries.com

Explain by Microsoft Copilot

2026年8月21日星期五

社交媒體與心理疲勞

When we use social media during our work breaks as a form of distraction, thinking that we are giving our brains a break, our energy resources are, in fact, still being allocated to something that is mentally taxing - getting a kick from doom-scrolling. This leads to cognitive overload, a state where the mind is overwhelmed by excessive information or stimuli, hindering our brain processing.

在工作休息時使用社交媒體並非真正讓大腦休息,因為瀏覽短片、滑動資訊仍然消耗心力。這樣會造成認知過載,即大腦被過多資訊刺激淹沒,導致思考與處理能力下降。

Being mentally taxing means a task or situation drains your brain and focus. It feels like your mind ran a long race, leaving you tired, stressed, or unable to think clearly

Doom-scrolling is the compulsive habit of spending excessive time scrolling through social media or news feeds to read negative, distressing, or alarming content.

incessant: never stopping

Curated content is the process of gathering, organizing, and sharing high-quality material created by others.

architect: a person whose job is designing buildings

treadmill: work or a way of life that is boring or makes you tired because it involves always doing the same things

Mental heuristics are fast "rules of thumb" or cognitive shortcuts that let people make quick decisions, solve problems, and form judgments with little mental energy. Pioneered by researchers like Daniel Kahneman and Amos Tversky, these tools save time, but they can also cause systematic errors or cognitive biases.

ingrained (in somebody/something) (of a habit, an attitude, etc.) that has existed for a long time and is therefore difficult to change

Social media apps use variable reward schedules - like slot machines - triggering dopamine spikes in the brain's reward pathway via likes, notifications, and infinite scrolling of novel content. This loop drives compulsive habits and can lead to a post-scroll dopamine deficit, leaving you feeling drained.

A slippery slope is a bad path or action. Once you start down this path, it is hard to stop. Small problems or choices lead to much bigger trouble.

lull somebody to make somebody relaxed and calm

paradoxically: in a way that seems strange, impossible or unlikely because it has two opposite features or contains two opposite ideas

thrill: a strong feeling of excitement or pleasure; an experience that gives you this feeling

yo-yo: a condition or situation marked by regular fluctuations from one extreme to another

drastically: in an extreme way that has a sudden, serious or violent effect on something

"Low-hanging fruit" is a common business and everyday phrase. It means an easy goal or a simple task that you can finish right now. Just like fruit on the lowest tree branch, these easy wins take very little effort to grab before you try harder work.

Nicole Vignola "Rewire"

hk.dictionary.search.yahoo.com

oxfordlearnersdictionaries.com

www.merriam-webster.com

Google AI overview

Explained by Microsoft Copilot

2026年8月16日星期日

Meaning

On Canon EOS cameras, “Tv” mode means Time Value (shutter‑priority mode). It lets you manually set the shutter speed while the camera automatically adjusts the aperture for correct exposure—ideal for freezing fast action or creating motion blur.

Microsoft Copilot

2026年8月13日星期四

Functions in Python

In Python, the return statement is used inside a function to send a value back to the caller and immediately stop the function’s execution. If no value is specified, Python automatically returns None.

def x():

    return 5

You define a function named x.

Inside the function, the return 5 statement tells Python to immediately stop running the function and send back the value 5.

Whenever you call x(), the function will give you 5.


In Python, the __code__ attribute is a special property of function objects that gives you access to the underlying code object representing the compiled function body.

def add(a, b):

    return a + b


print(add.__code__)  

# Output: <code object add at 0x..., file "script.py", line 1>


print(add.__code__.co_varnames)   # ('a', 'b')

print(add.__code__.co_argcount)   # 2

print(add.__code__.co_filename)   # "script.py"

print(add.__code__.co_name)       # "add"


backslash n
In Python, \n is the escape sequence for a newline character. It tells Python to move the cursor to the next line when printing text.

for punctuation in punctuations:
is a for loop in Python. It means: “Take each element from the list punctuations one by one, and temporarily call it punctuation.”

text = text.replace('\n', ' ')
means: “Take the string stored in text, and replace every newline character (\n) with a space (' ').”
So here, every line break is turned into a space.

def removeShortWords(text):
    return ' '.join([word for word in text.split() if len(word) > 3])
is a list comprehension filter that removes short words (length ≤ 3) from a string.
text.split() → splits the string into words (by spaces). Example: "This is a test"["This", "is", "a", "test"].
[word for word in text.split() if len(word) > 3] → keeps only words longer than 3 characters.
' '.join([...]) → joins the filtered words back into a single string with spaces.

In Python, lambda functions are small, anonymous functions defined with the lambda keyword. They’re often used when you need a quick, throwaway function without formally writing def.

In Python, sorted() is a built‑in function that returns a new sorted list from any iterable (like lists, tuples, or strings). It does not modify the original object — it creates a new one.

Iterable: a programming concept for data collections you can loop through

myList = [{'num': 3}, {'num': 2}, {'num': 1}]
sorted(myList, key=lambda x: x['num'])

The key=lambda x: x['num'] tells Python: “Sort by the value of the 'num' field inside each dictionary.”

lambda x: x['num'] is a small anonymous function that takes each dictionary (x) and returns the value associated with the key 'num'.

A dictionary in Python is a built‑in data structure that stores data as key–value pairs. Think of it like a real dictionary: the key is the word you look up, and the value is the definition you get.

Microsoft Copilot

2026年8月12日星期三

物候學

物候學(Phenology)是一門研究生物季節性現象與環境因子之間關係的科學。它關注的是植物、動物在一年四季中隨著氣候變化而出現的週期性活動,例如開花、結果、遷徙、蛙鳴、昆蟲羽化等。

Microsoft Copilot