题解 | #淘汰排名最后的学生#
淘汰排名最后的学生
https://www.nowcoder.com/practice/d7cc81fa615c4231b5f86c97e5b275b4
s=input().split() s.pop(-1) s.pop(-1) s.pop(-1) print(s)
sentence=['All', 'good', 'things', 'come', 'to' ,'those', 'who', 'wait.']
print("默认为 index=-1,删除最后一个列表值:",sentence.pop(-1))
print("默认删除最后一个列表值: ",sentence.pop(),"\n")
print("删除第一个元素:",sentence.pop(0),"\n")
print("删除第三个元素:",sentence.pop(2),"\n")
print("输出剩余元素:",sentence)