Discuss / Python / HomeWork

HomeWork

Topic source
def get_score_in(cursor,low,high):
    cursor.execute("select * from user t where t.score >= ? and t.score <= ?",(low,high))
    values = cursor.fetchall()
    print(list(map(lambda x:x[1],sorted(values,key=lambda x:x[2]))))
try:
    conn = sqlite3.connect(db_file)
    cursor = conn.cursor()
    get_score_in(cursor,60,95)
finally:
    cursor.close()
    conn.close()

  • 1

Reply