题解 | #NP31 团队分组#
团队分组
https://www.nowcoder.com/practice/113a0507b1144fa9a602c2a3cd847205?tpId=314&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3DPython%25E7%25AF%2587%26topicId%3D314
我觉得中间这个索引值,还是可以算一算的
group_list = ['Tom', 'Allen', 'Jane', 'William', 'Tony'] print(group_list[:2]) #中间三个,找到中间的索引值 mid = len(group_list)//2 print(group_list[mid-1:mid+2]) print(group_list[-2:])