#coding=big5 # 分數表第二版 # 展示巢狀序列 # Michael Dawson - 1/31/03 scores = [] choice = None while choice != "0": print \ """ High Scores Keeper 0 - 結束 1 - 列出分數 2 - 增添分數 """ choice = raw_input("選擇: ") print # 跳出 if choice == "0": print "再見" # 顯示分數表 elif choice == "1": print "姓名\得分" for entry in scores: score, name = entry print name, "\t", score # 增添一比分數 elif choice == "2": name = raw_input("玩家名稱: ") score = int(raw_input("得分: ")) entry = (score, name) scores.append(entry) scores.sort() scores.reverse() # want the highest number first # 其他未知的選擇 else: print "抱歉 ", choice, "選擇無效" raw_input("\n\n按 enter 結束")