单选题 适中
#16263

班级组织户外活动,老师要统计带水杯的同学名单。已知学生信息列表为: students = [{"name": "小明", "has_cup": True}, {…

班级组织户外活动,老师要统计带水杯的同学名单。已知学生信息列表为:

students = [{"name": "小明", "has_cup": True}, {"name": "小红", "has_cup": False}, {"name": "小刚", "has_cup": True}],正确的推导式是?( )

未登录也能判分,登录后才会记录
答案与解析
正确答案:C
解析

A选项的has_cup未指明属于student字典;B和D语法错误(Python无where和when关键字。