1.元素分类 有如下值集合[11,22,33,44,55,66,77,88,99,90], 将所有大于66的值保存至字典的第一个key中,将小于66值保存至第二个key的值中. li = [11,22,33,44,55,66,77,88,99,90] dic = {} n = [] m = [] for i in li: if i > 66: n.append(i) if i < 66: m.append(i) dic.update(k1 = m, k2 = n) print(dic) 2.输
Python/ MySQL练习题(一) 查询“生物”课程比“物理”课程成绩高的所有学生的学号 SELECT * FROM ( SELECT * FROM course LEFT JOIN score ON score.course_id = course.cid WHERE course.cname = '生物' ) AS A INNER JOIN ( SELECT * FROM course LEFT JOIN score ON score.course_id = course.cid WHE
python/MySQL练习题(二) 查询各科成绩前三名的记录:(不考虑成绩并列情况) select score.sid,score.course_id,score.num,T.first_num,T.second_num from score left join ( select sid, (select num from score as s2 where s2.course_id = s1.course_id order by num desc limit 0,1) as first_nu