Discuss / Python / 交作业

交作业

Topic source

def by_name(t): return t[0].lower()

def by_name(t): return -t[1]

秀!

方长69501

#3 Created at ... [Delete] [Delete and Lock User]

秀!

纹枰之间

#4 Created at ... [Delete] [Delete and Lock User]

能不能麻烦大佬解释一下-t[1]是啥意思...为啥这么用

-1[t] 的意思是先把列表里的数变负数啊 然后就可以按照老师的要求进行排序

厉害啊

达仔hongda

#7 Created at ... [Delete] [Delete and Lock User]

拿笔小星

#8 Created at ... [Delete] [Delete and Lock User]

t[0].lower()是错误的,排序结果可以看出 直接t[0]即可。 因为t[0].lower()返回的是函数!

Thatsmynigga

#9 Created at ... [Delete] [Delete and Lock User]

应该学学数据结构

Gonathan佳

#10 Created at ... [Delete] [Delete and Lock User]

厉害 自己都没能想出来啊啊啊啊 多学习


  • 1
  • 2

Reply