Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 850 Bytes

python-sort.md

File metadata and controls

18 lines (16 loc) · 850 Bytes

如何通过ChatGPT和Claude学习Python排序

ChatGPT

  1. in python, what's the difference between list.sort() and sorted()
  2. what other advantages can i gain using sorted()
  3. in the above example, how can i improve the key=lambda person: person.age?
  4. maybe use some tool from the operator library?
  5. can you compare the performance of using lambda and attrgetter?
  6. i need to sort a list of tuples with 2 elements each, ordered by the first element.
  7. what if i want to reverse the order?

Claude

  1. in python, what's the difference between list.sort() and sorted()
  2. what other advantages can i gain using sorted()
  3. can we use some tool from the operator library as key
  4. 请给我一个sorted链式调用的例子
  5. 比较一下lambda和attrgetter的性能表现
  6. give me an example showing that list.sort() is not stable