返回列表 發帖

APCS大學程式設計先修檢測(2016/03/05)第3題

本帖最後由 ray 於 2022-1-23 10:49 編輯

https://zerojudge.tw/ShowProblem?problemid=b966
#輸入字串(160 180)用空白分割成兩個數字字串
s = input()
s2 = s.split(' ')
#二維陣列
a = []
b = [160,180]
a.append(b)
b = [150,200]
a.append(b)
print(a)
#排序
a.sort(key=lambda x:x[0])
#迴圈取值
for i in range(0,len(a)):
    print(a[0], a[1])

返回列表