#Python TQC考題606 二維串列行列數
#偷吃步沒用陣列做
rows=eval(input())
cols=eval(input())
for r in range(rows):
for c in range(cols):
print(“%4d” %(c-r),end=””) #不換行
print() #換行

#理解比較透徹的話,確實沒必要用陣列做:

#正統寫法
#使用陣列以及自定義函數
rows=eval(input())
cols=eval(input())
def compute(L):
for r in range(rows):
for c in range(cols):
print(“%4d” %L[r][c],end=””)
#不換行
print() #換行
L=[]
for r in range(rows):
L.append([])
#L有cols個元素,下一行for迴圈開始寫入
for c in range(cols):
L[r].append(c-r)
#L[r]不是L[c]
compute(L)

#第三次做
def compute(lt):
for r in range(rows):
for c in range(cols):
print(“%4d”%lt[r][c],end=””)
print()
#跟內層的迴圈同縮排
rows=eval(input())
cols=eval(input())
lt=[]
for r in range(rows):
lt.append([])
for c in range(cols):
lt[r].append(c-r)
compute(lt)

#直接印就好,跟list根本無關

# c-r :


![Python如何串接OpenAI /Claude /Gemini API自動將大量維修紀錄JSON轉自然語言描述(並避免中斷資料遺失)response = client.chat.completions.create() ; reply = response.choices[0].message.content Python如何串接OpenAI /Claude /Gemini API自動將大量維修紀錄JSON轉自然語言描述(並避免中斷資料遺失)response = client.chat.completions.create() ; reply = response.choices[0].message.content](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2025/07/20250716084059_0_c5b368.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



![Python Logging 完全指南:從基礎到實戰應用; import logging ; logging.basicConfig(level=logging.INFO, handlers=[ logging.StreamHandler(), logging.FileHandler(‘app.log’, mode=’a’, encoding=’utf-8′)] ) ; inspect.currentframe().f_code.co_name #動態取得funcName Python Logging 完全指南:從基礎到實戰應用; import logging ; logging.basicConfig(level=logging.INFO, handlers=[ logging.StreamHandler(), logging.FileHandler(‘app.log’, mode=’a’, encoding=’utf-8′)] ) ; inspect.currentframe().f_code.co_name #動態取得funcName](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2025/10/20251021155823_0_c16012.png?quality=90&zoom=2&ssl=1&resize=350%2C233)




近期留言