###### tags: `Python`,`TQC` # TQC+ 程式語言Python 702 數組合併排序 1. 題目說明: 請開啟PYD702.py檔案,依下列題意進行作答,將兩數組合併並進行排序,使輸出值符合題意要求。作答完成請另存新檔為PYA702.py再進行評分。 2. 設計說明: 請撰寫一程式,輸入並建立兩組數組,各以-9999為結束點(數組中不包含-9999)。將此兩數組合併並從小到大排序之,顯示排序前的數組和排序後的串列。 3. 輸入輸出: 輸入說明 兩個數組,直至-9999結束輸入 輸出說明 排序前的數組 排序後的串列 ![](https://i.imgur.com/V1oXZjp.png) ```python= print("Create tuple1:") L1 = [] while True: a = eval(input()) if a != -9999: L1.append(a) else: break print("Create tuple2:") L2 = [] while True: a = eval(input()) if a != -9999: L2.append(a) else: break t = tuple(L1)+tuple(L2) L3 = sorted(L1+L2) print("Combined tuple before sorting: {}".format(t)) print("Combined list after sorting: {}".format(L3)) ```