Python Algorithm Exercise Codes