###### tags: `Python`,`TQC` # TQC+ 程式語言Python 709 詞典排序  1. 題目說明: 請開啟PYD709.py檔案,依下列題意進行作答,輸入顏色詞典並進行排序,使輸出值符合題意要求。作答完成請另存新檔為PYA709.py再進行評分。 2. 設計說明: 請撰寫一程式,輸入一顏色詞典color_dict(以輸入鍵值"end"作為輸入結束點,詞典中將不包含鍵值"end"),再根據key值的字母由小到大排序並輸出。 3. 輸入輸出: 輸入說明 輸入一個詞典,直至end結束輸入 輸出說明 根據key值字母由小到大排序輸出  ```python= color_d = {} while True: a = input("Key: ") if a != "end": color_d[a] = input("Value: ") else: break for i in sorted(color_d.keys()): print("{}: {}".format(i,color_d[i])) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up