python-07

1.代碼 #組織列表 #排序: persons = [‘Charlie’,‘Bob’,‘Alice’,‘David’] #臨時排序,原列表不變,返回一個排序後的新列表。 sorted_persons = sorted(persons) print(persons) #永久排序,原列表將會修改 persons.sort() print(persons) #函數len()獲取列表長度 print(le
相關文章
相關標籤/搜索