【发布时间】:2023-01-26 17:43:39
【问题描述】:
output = [('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO'),('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO'),('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO'),('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO'),('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO'),('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO')]
所以上面的列表中总共有 6 组 ('studentA','ISDF'), ('studentB','CSE'),('studentC','BIO')
所以我期待这样的输出~
预期输出 = [('studentA','ISDF',6), ('studentB','CSE',6),('studentC','BIO',6)]
格式应为[('student', 'department', total count)]
【问题讨论】: