# 設定要從哪個範圍內抽取號碼 MIN_NUM = 1 MAX_NUM = 100 # 設定要抽取幾個號碼 NUMS_TO_PICK = 5 # 使用 random.sample 函式隨機抽取 NUMS_TO_PICK 個不重複的整數 nums = random.sample(range(MIN_NUM, MAX_NUM+1), NUMS_TO_PICK) # 印出抽到的號碼 print("抽到的號碼:", nums)