2025年8月4日 星期一

Python Unit 3 Lesson 4: Loop control flow 的 Challenge: Infectious diseases

 import virus


population = 10000

infected = 1

can_catch_virus = population - infected

contacts_per_day = 10

newly_recovered = 0


for day in range(90): # day 從 0 開始,到 89。如果要從 1 開始到 90,就要寫成 range(1,91)。

    # Infected chickens spread the virus to those who haven't already had it.

    if day > 13: # 因為 day 是從 0 起算,所以 13 代表 day 14。

        contacts_per_day = 3

    newly_infected = virus.spread(

        infected, can_catch_virus, population, contacts_per_day

    )


    newly_recovered = virus.recover(infected)

    infected = infected + newly_infected - newly_recovered

    can_catch_virus = can_catch_virus - newly_infected


    print(str(infected) + " chickens infected.")


    if infected == 0 :

        break


print("----------")

print(str(population - can_catch_virus) + " chickens caught the virus.")


教師留言給晉維英文課-8月4日

     2025/08/04(一) 8:00-8:50 

  1. 今日教學進度:
    1. 教師和晉維檢討上週作業指派。晉維有複習聽力練習Marathons,和《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之 Conclusion  及第 31 段 1-3 句,《弦元佑文法解題》第10章語態。
    2. 教師帶領晉維精讀《Heart of the Matter》第 32 段 1-3 句、第 32 段之文意解說之第 1-2 節。
  2. 作業指派:
    1. 請晉維自自修聽力練習Climate change - can we stop it? 》。
    2. 請晉維複習《Heart of the Matter》第 32 段 1-3 句、第 32 段之文意解說之第 1-2 節。
    3. 請晉維預習《Heart of the Matter》第 32 段之文意解說之第 3 節,Semantic Themes and Relationships , Implications and Interpretations,Conclusion,和 Overall Message。
    4. 請晉維自修《弦元佑文法解題》第13章動名詞。

  3. 下次課程計畫: 
    1. 檢閱作業派執行狀況
    2. 教師指導晉維精讀 《Heart of the Matter》第 32 段之文意解說之第 3 節,Semantic Themes and Relationships , Implications and Interpretations,Conclusion,和 Overall Message。
  4. 附註:
    1. 教師將請假赴美,期間: 8/18(一)~9/3(三)。有三個星期一:8/18、8/25、和 9/1。
    2. 在此期間教師將指派作業給晉維自修。
      1. 關於聽力練習部分:1) Where money has no value 2) Scouting moves ahead
      2. 關於弦元佑文法解題部份:1) 第14章不定詞片語,2) 第15章對等連接詞。
    3. 下次上課日期預訂9/8(一),可能會需要配合晉維學校的課表而變動。

教師留言給尤靖恩尤佳恩程式設計課-8/4

    2025/08/04(一) 14:00-16:20

  1. 今日教學進度:
    1. 教師帶領靖恩和佳恩檢討上次作業指派:
      1. 猜數字遊戲 (使用 random)
      2.  • 程式隨機選數字,程式自猜,程式提示太大或太小。
      3.  • 強化點:
      4.  • 用 random.randint()。
      5.  • 加入計分機制與猜錯次數。
      6.  • 顯示「你用了幾次才猜對」。
      7. 使用 Thonny 平台。
      8. 靖恩完成程式設計,設定數字範圍為 1~1,000,測試約 30 次,結果都在 10 次以下猜對。
      9. 這符合每次猜中間數的演算法的 BigO 預測:log(1000,2) =  9.966。
    2. 教師帶領靖恩和佳恩學習 Python Unit 3 Lesson 4: Loop control flow 的 Practice: Trace break and continue statements,完成 3 題,共 4 題。最後一題題目如下,待下次完成:

  2. 作業指派:
    1. 請靖恩和佳恩複習 Khan Academy Python Unit 3 Lesson 4: Loop control flow 的教學影片、文件、和測驗。
    2. 請靖恩和佳恩自修 Khan Academy Python Unit 3 Lesson 4: Loop control flow 的 Challenge: Infectious diseases。當看不懂程式說明的英文時,請複製到 Google 翻譯,可以看中文。也可以用 Yahoo 字典查音標、聽語音、以及單字之詞類及用法。
  3. 下次課程計畫:
    1. 2025/08/11(一) 14:00-16:00
    2. 教師檢查靖恩及佳恩作業
    3. 教師指導靖恩及佳恩學習 Khan Academy Python Unit 3 Lesson 5: Simulating populations。

2025年8月2日 星期六

猜數字:程式隨機出題,程式自行解題

import random

import math

max = 1000 # 最大數字

number = random.randint(1,max) # 程式隨機出題, 1~1000 之間。

score = math.ceil(math.log(max,2)) # 起始分數為最大數字取2為底的對數的下一個整數,若猜中時,得到負分表示猜數的演算法不佳

got_it = False # False 表示還沒有答對,True 表示答對了

times = 0 # 計算共猜了多少次

# 演算法:用持續限縮範圍法,一直把可能的最小數字和最大數字加總除以 2 ,直到猜中為止。

low = 1 # 可能的最小數字

high = max # 可能的最大數字

print("Your initial score is " + str(score) +".")

while got_it == False: # 當還沒有猜對,就繼續猜

    times += 1 # 猜的次數加 1

    print("------------------") # 每次猜測相關數字的分隔線

    print("low = " + str(low)) # 現示最小可能數字

    print("high = " + str(high)) # 現示最大可能數字

    guess = int((low+high)/2) # 試猜數字 = 把可能的最小數字和最大數字加總除以 2 

    print("You guess " + str(guess) + ".")

    print("number = " + str(number))

    if guess > number: #  如果猜的數字太大

        score -= 1 # 扣一分

        high = guess-1 # 把最大可能數字改為試猜數字減 1

        print("Too big! Try again.") # 顯示所猜數字太大

        print("Your score is " + str(score) + ".") # 顯示目前分數

    elif guess < number: #  如果猜的數字太小

        score -= 1# 扣一分

        low = guess+1 # 把最小可能數字改為試猜數字加 1

        print("Too small! Try again.") # 顯示所猜數字太小

        print("Your score is " + str(score) + ".") # 顯示目前分數

    else: # 答對了

        got_it = True # 把 got_it 改為 True,表示答對了。原本是 False

        print("Congratulation! You got it!") # 顯示答對了

        print("Your have tried " + str(times) + " times.") # 顯示共猜了多少次

        print("Your score is " + str(score) + ".") # 顯示最後得分


2025年7月28日 星期一

教師留言給晉維英文課-7月28日

    2025/07/28(一) 8:00-8:50 

  1. 今日教學進度:
    1. 教師和晉維檢討上週作業指派。晉維有複習聽力練習Living Underground,和《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-4 節,《弦元佑文法解題》第8章分詞 (後半部)。
    2. 教師帶領晉維精讀《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之 Conclusion  及第 31 段 1-3 句。
  2. 作業指派:
    1. 請晉維自自修聽力練習Marathons》。
    2. 請晉維複習《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之 Conclusion  及第 31 段 1-3 句。
    3. 請晉維預習《Heart of the Matter》第 32 段 1-3 句、第 32 段之文意解說之第 1-3 節,Semantic Themes and Relationships 及 Implications and Interpretations。
    4. 請晉維自修《弦元佑文法解題》第10章語態。

  3. 下次課程計畫: 
    1. 檢閱作業派執行狀況
    2. 教師指導晉維精讀 《Heart of the Matter》第 32 段 1-3 句、第 32 段之文意解說之第 1-3 節,Semantic Themes and Relationships 及Implications and Interpretations。
  4. 附註:
    1. 教師將請假赴美,期間: 8/18(一)~9/3(三)。
    2. 在此期間教師將指派作業給晉維自修。
      1. 關於聽力練習部分:1) Climate change - can we stop it? 2) Where money has no value 3) Scouting moves ahead
      2. 關於弦元佑文法解題部份:1) 第13章動名詞,2) 第14章不定詞片語,3) 第15章對等連接詞。
    3. 下次上課日期預訂9/8(一),可能會需要配合晉維學校的課表而變動。

教師留言給尤靖恩尤佳恩程式設計課-7/28

   2025/07/28(一) 14:00-16:00

  1. 今日教學進度:
    1. 教師帶領靖恩和佳恩學習 Python Unit 3 Lesson 3 For loops 的 Challenge: Wait times。
    2. 教師帶領靖恩和佳恩設計程式解教師自訂題目:
      1. 猜數字遊戲 (使用 random)
      2.  • 電腦隨機選數字,玩家猜,電腦提示太大或太小。
      3.  • 強化點:
        1.  • 用 random.randint()。
        2.  • 加入計分機制與猜錯次數。
        3.  • 顯示「你用了幾次才猜對」。
      4. 請使用 Thonny 平台。
  2. 作業指派:
    1. 請靖恩和佳恩複習 Khan Academy Python Unit 3 Lesson 3 For loops 的 Challenge: Wait times。
    2. 請靖恩和佳恩自修 Khan Academy Python Unit 3 Lesson 3 For loops 的教學影片、文件、和測驗。
    3. 請靖恩和佳恩修改猜數字遊戲。把原來讓「使用者」猜數字,改為讓「電腦」猜數字。
  3. 下次課程計畫:
    1. 2025/08/4(一) 14:00-16:00
    2. 教師檢查靖恩及佳恩作業
    3. 教師指導靖恩及佳恩完成修改猜數字遊戲,把原來讓「使用者」猜數字,改為讓「電腦」猜數字。

2025年7月21日 星期一

教師留言給晉維英文課-7月21日

   2025/07/21(一) 8:00-8:50 

  1. 今日教學進度:
    1. 教師和晉維檢討上週作業指派。晉維有複習聽力練習The end of the World?,和《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-4 節,《弦元佑文法解題》第8章分詞 (前半部)。
    2. 教師帶領晉維精讀《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 5 節、 Semantic Relationships and Implications。
  2. 作業指派:
    1. 請晉維自自修聽力練習《Living Underground》。
    2. 請晉維複習《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-4 節。
    3. 請晉維預習《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之 Conclusion、第 31 段 1-3 句、第 32 段 1-3 句、第 32 段之文意解說之第 1 節。
    4. 請晉維自修《弦元佑文法解題》第8章分詞 (後半部)。

  3. 下次課程計畫: 
    1. 檢閱作業派執行狀況
    2. 教師指導晉維精讀 《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之 Conclusion、第 31 段 1-3 句、第 32 段 1-3 句、第 32 段之文意解說之第 1 節。

Python Unit 3 Lesson 3 - For loops - Challenge: Waiting times

 Challenge

import random


num_cashiers = 1

num_cooks = 2


waiting_to_order = 0

waiting_for_food = 0

num_customers_served = 0


for minutes in range(300):

    # Customers arrive every minute and line up to order.

    waiting_to_order = waiting_to_order + random.randint(0, 6)

    

    # Each cashier can take up to three orders per minute.

    new_orders = min(num_cashiers * 3, waiting_to_order)

    

    # After ordering, customers wait for their food to be made.

    waiting_to_order = waiting_to_order - new_orders

    waiting_for_food = waiting_for_food + new_orders


    # Each cook can make up to 1 food per minute.

    new_food = min(num_cooks*1, waiting_for_food)

    num_customers_served = num_customers_served + new_food


    # After providing food, 

    # the customer moves out of the waiting_for_food state.

    waiting_for_food = waiting_for_food - new_food

    

    print(str(waiting_to_order) + " customers waiting to order.")

    print(str(waiting_for_food) + " customers waiting for food.")

print("The total number of customers served is " + \

      str(num_customers_served) + "!")

Bonus

import random

num_cashiers = 2
num_cooks = 5

waiting_to_order = 0
waiting_for_food = 0
num_customers_served = 0

# from 12-2pm the customer arrival rate ever minute = (3, 6)
for minutes in range(120):
    # Customers arrive every minute and line up to order.
    waiting_to_order = waiting_to_order + random.randint(3, 6)
    
    # Each cashier can take up to three orders per minute.
    new_orders = min(num_cashiers * 3, waiting_to_order)
    
    # After ordering, customers wait for their food to be made.
    waiting_to_order = waiting_to_order - new_orders
    waiting_for_food = waiting_for_food + new_orders

    # Each cook can make up to 1 food per minute.
    new_food = min(num_cooks*1, waiting_for_food)
    num_customers_served = num_customers_served + new_food

    # After providing food, 
    # the customer moves out of the waiting_for_food state.
    waiting_for_food = waiting_for_food - new_food
    
    print(str(waiting_to_order) + " customers waiting to order.")
    print(str(waiting_for_food) + " customers waiting for food.")

# Rearrange the staff
num_cashiers = 1
num_cooks = 2
waiting_to_order = 0
waiting_for_food = 0
print("The total number of customers served is " + \
      str(num_customers_served) + "!")
print("----------------------------")
print("----------------------------")
print("----------------------------")
# from 2-5pm the customer arrival rate ever minute = (0, 3)
for minutes in range(180):
    # Customers arrive every minute and line up to order.
    waiting_to_order = waiting_to_order + random.randint(0, 3)
    
    # Each cashier can take up to three orders per minute.
    new_orders = min(num_cashiers * 3, waiting_to_order)
    
    # After ordering, customers wait for their food to be made.
    waiting_to_order = waiting_to_order - new_orders
    waiting_for_food = waiting_for_food + new_orders

    # Each cook can make up to 1 food per minute.
    new_food = min(num_cooks*1, waiting_for_food)
    num_customers_served = num_customers_served + new_food

    # After providing food, 
    # the customer moves out of the waiting_for_food state.
    waiting_for_food = waiting_for_food - new_food
    
    print(str(waiting_to_order) + " customers waiting to order.")
    print(str(waiting_for_food) + " customers waiting for food.")

print("The total number of customers served is " + \
      str(num_customers_served) + "!")

教師留言給尤靖恩尤佳恩程式設計課-7/21

  2025/07/21(一) 14:00-16:00

  1. 今日教學進度:
    1. 教師帶領靖恩和佳恩學習 Python Unit 3 Lesson 2 While loops 的 Challenge: Dice rolls。
  2. 作業指派:
    1. 請靖恩和佳恩複習 Khan Academy Python Unit 3 Lesson 2 While loops 的 Challenge: Dice rolls。
    2. 請靖恩和佳恩自修 Khan Academy Python Unit 3 Lesson 2 While loops 的教學影片、文件、和測驗。

  3. 下次課程計畫:
    1. 2025/07/28(一) 14:00-16:00
    2. 教師檢查靖恩及佳恩作業
    3. 教師指導靖恩及佳恩完成  Khan Academy Python Unit 3 Lesson 3 For loops 的 Challenge: Wait times。

兩顆骰子點數和的機率和期望值



一、可能的點數,最小是 2,最大是 12,各點數的可能情況如下:

  1. 2 點:(1,1)
  2. 3 點:(1,2), (2,1)
  3. 4 點:(1,3), (2,2), (3,1)
  4. 5 點:(1,4), (2,3), (3,2), (4,1)
  5. 6 點:(1,5), (2,4), (3,3), (4,2), (5,1)
  6. 7 點:(1,6), (2,5), (3,4), (4,3), (5,2), (6,1)
  7. 8 點: (2,6), (3,5), (4,4), (5,3), (6,2)
  8. 9 點: (3,6), (4,5), (5,4), (6,3)
  9. 10 點:(4,6), (5,5), (6,4)
  10. 11 點:(5,6), (6,5)
  11. 12 點:(6,6)
    總共有 1+2+3+4+5+6+5+4+3+2+1 = 36 種情況,每一種情況的機率一樣。
    2 點的機率是 1/36,3 點的機率是 2/36 ...

二、所以兩顆骰子點數和的期望值是:

  1. (1*2+2*3+3*4+4*5+5*6+6*7+5*8+4*9+3*10+2*11+1*12)/36=7

Python Unit 3 Lesson 2 - While loops - Challenge: Dice rolls

Step 1, 2 

import random

dice_total = 0

i = 1 # for counting while loop

while i <= 10:

    # Roll two six-sided dice.

    first_die = random.randint(1, 6)

    second_die = random.randint(1, 6)

    dice_sum = first_die + second_die

    print("You rolled a " + str(dice_sum) + "!")

    dice_total = dice_total + dice_sum

    i = i + 1

dice_average = dice_total / 10

print("The average of dice roll is " + str(dice_average))

Step 3

import random

experiment_times = int(input("How many times do you want \
to repeat the experiment? "))
dice_total = 0
i = 1 # for counting while loop
while i <= experiment_times:
    # Roll two six-sided dice.
    first_die = random.randint(1, 6)
    second_die = random.randint(1, 6)

    dice_sum = first_die + second_die
    print("You rolled a " + str(dice_sum) + "!")
    dice_total = dice_total + dice_sum
    i = i + 1

dice_average = dice_total / experiment_times
print("The average of dice roll for " + \
      str(experiment_times) + " times is " + str(dice_average))

2025年7月14日 星期一

教師留言給尤靖恩尤佳恩程式設計課-7/14

 2025/07/14(一) 14:00-16:00

  1. 今日教學進度:
    1. 教師帶領靖恩和佳恩學習 Python Unit 3 Lesson 1 Module imports
  2. 作業指派:
    1. 請靖恩和佳恩自修 Khan Academy Python Unit 3 Lesson 1 Module imports 設計程式,並測試,及除錯。
    2. 請靖恩及佳恩預習 Khan Academy Python Unit 3 Lesson 2 While loops 的教學影片和文件。
  3. 下次課程計畫:
    1. 2025/07/21(一) 14:00-16:00
    2. 教師檢查靖恩及佳恩作業
    3. 教師指導靖恩及佳恩完成  Khan Academy Python Unit 3 Lesson 2 While loops 的 Challenge: Dice rolls。

教師留言給晉維英文課-7月14日

  2025/07/14(一) 8:10-9:00 

        註:《青少年追求卓越》網站虛擬主機當機維修中,教師留言暫置教師的部落格。

  1. 今日教學進度:
    1. 教師和晉維檢討上週作業指派。晉維有複習聽力練習,和《Heart of the Matter》
    2. 教師指導晉維使用The end of the World?》的學習資源。
    3. 教師帶領晉維精讀《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-4 節。
  2. 作業指派:
    1. 請晉維複習上週聽力練習The end of the World?
    2. 請晉維複習《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-4 節。
    3. 請晉維預習《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 5 節、 Semantic Relationships and Implications 和 Conclusion、以及第 31 段 1-3 句。
    4. 請晉維自修Living Underground
    5. 請晉維自修《弦元佑文法解題》第8章分詞,可以分兩週進行:7/15(二) ~ 7/21(一),以及7/22(二) ~ 7/28(一)。

  3. 下次課程計畫: 
    1. 檢閱作業派執行狀況
    2. 教師指導晉維精讀 《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 5 節、 Semantic Relationships and Implications 和 Conclusion、以及第 31 段 1-3 句。

2025年7月9日 星期三

如何發展用英文表達自己的意見、想像、和經驗的能力?

我的母語是中文。我認為我要發展用英文表達自己的、想像、和經驗的能力的最有效方法就是先要有能力用母語表達,然後學習AI翻譯出來的英文。你覺得怎麼樣?

ChatGPT回答

你的想法非常有道理,而且是一個相當有效的語言學習策略。這種方法的核心邏輯是「先理解、再表達」,而你用「母語先行 + AI 翻譯 + 英文學習」的方式,正好符合這個邏輯。以下是我對你方法的看法與建議:

✅ 為什麼這樣做是有效的:

  1. 先用中文思考,有助於思想深度與情感真實性
    你用母語(中文)表達時,不受語言能力限制,能更清楚地表達自己的想法、感受與經驗,這是培養內容深度和真誠表達的關鍵。
  2. AI 翻譯作為「橋梁」
    透過 AI 翻譯,你可以獲得符合英文語法和用法的譯文,進而反思「原來這樣的中文可以這樣說成英文」,從中學到地道的英文表達。
  3. 符合語言學習的自然遷移模式
    這種方式類似「從已知轉向未知」,能有效促進母語與外語之間的語意連結,強化記憶,也降低學習挫折感。

🔍 建議的進一步做法:

  1. 加入對比學習:
    嘗試觀察 AI 翻譯與你自己原本想像的英文說法有什麼不同,並思考「為什麼 AI 這樣說更自然?」。
  2. 反覆輸出練習:
    把 AI 翻譯的句子背下來或轉換成你自己的說法,用英文口說或寫下來,加強語感與語言肌肉記憶。
  3. 主題聚焦學習:
    可以以一個主題為單位,例如「我童年的一件回憶」、「我最近的心情」、「我對某件事的想法」,一方面寫中文日記,一方面用 AI 協助轉譯成英文日記,逐步擴展語言表達範圍。

🧠 心得總結:

你走的是「內容先行、語言漸進」的路,這不僅適合成人學習者,也特別適合你希望傳承思想、智慧與經驗的目標。英文的進步會在這樣的堅持下,自然而然發生。

如果你願意,我可以持續協助你把你寫的中文內容翻成合適的英文,並標示中英文對應句子。這樣的學習記錄還可以成為你的英文寫作素材庫。

你願意我這樣協助你嗎?如果可以,我們可以從你的一篇中文日記或想法開始。



2025年7月7日 星期一

教師留言給晉維英文課

 2025/0707(一) 8:10-9:00 

        註:《青少年追求卓越》網站虛擬主機當機維修中,教師留言暫置教師的部落格。

  1. 今日教學進度:
    1. 教師帶領晉維精讀《Heart of the Matter》第 29 段第 5-7 句,第 30 段第 1-5 句,及第 30 段語意解說(Semantic Analysis)之第 1 節 Dual Roles Centered Around the Heart。
  2. 作業指派:
    1. 請晉維複習上週聽力練習
      1. Learn English | Listening Practice - Listening to a English Weather Forecast
      2. Learn English | Listening Practice - Talking About a Photo in English
      3. Learn English | Listening Practice - Scheduling a Checkup in English
    2. 請晉維複習《Heart of the Matter》第 29 段第 5-7 句,第 30 段第 1-5 句,及第 30 段語意解說(Semantic Analysis)之第 1 節 Dual Roles Centered Around the Heart。
    3. 請晉維預習《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-5 節及 Semantic Relationships and Implications 和 Conclusion。
    4. 請晉維自修The end of the World?
      1. 點語音播放器可播放語音。參考圖如下:
      2. 填空測驗:從 21 個單字表中選填到 15 個空格,每一個空格限 1 個字。參考圖如下:
    5. 請晉維自修《弦元佑文法解題》第8章分詞

  3. 下次課程計畫: 
    1. 檢閱作業派執行狀況
    2. 教師指導晉維精讀 《Heart of the Matter》第 30 段語意解說(Semantic Analysis)之第 2-5 節及 Semantic Relationships and Implications 和 Conclusion。

教師留言給尤靖恩尤佳恩程式設計課

 2025/0707(一) 14:00-16:00

  1. 今日教學進度:
    1. 教師帶領靖恩和佳恩複習 Python Unit 2 Lesson 5
    2. 教師指導靖恩和佳恩學習畫程式流程圖
  2. 作業指派:
    1. 請靖恩和佳恩自修在 Khan Academy Python Unit 2 Lesson 5 設計程式,並測試,及除錯。
    2. 請靖恩及佳恩預習 Khan Academy Python Unit 3 Lesson 1
  3. 下次課程計畫:
    1. 2025/07/14(一) 14:00-16:00
    2. 教師檢查靖恩及佳恩作業
    3. 教師指導靖恩及佳恩完成  Khan Academy Python Unit 3 Lesson 1 程式流程圖,及編寫程式碼。