Question: [Python] get_students: This function takes a connection object to a student database (like the one we've been working with), a table name, and a grade

[Python] get_students: This function takes a connection object to a student database (like the one we've been working with), a table name, and a grade and returns a list of all of the student names in sorted order who received that grade in that table. Student names should be in format "last, first".

Here is test file

def test_get_students(self):

ista_130_f17_A = ['Beseboc, Chris', 'Bifedok, Alyssa', 'Burapev, Brian', 'Darefir, Parker',

'Dotasak, Zach', 'Drebegan, Scott', 'Drimaliz, Dingbo', 'Fipugax, Anmol', 'Gahejov, Vamsee',

'Gufunoz, Bri', 'Herorab, Daniyal', 'Hixawez, Matthew', 'Kariraw, Josh', 'Nafusut, Matt',

'Netiwom, Brandon', 'Noqalux, Chi', 'Peyufod, Yao', 'Pikuber, Isaac', 'Ragoziz, Brandon',

'Roruvor, Brian', 'Roxawos, Robbie', 'Sagadot, Bailie', 'Scafonis, Gordon', 'Stibolar, Hongzhi',

'Suwarij, Fengyi', 'Virabus, Christopher', 'Visigob, Jonah', 'Xaruliy, Jessie', 'Xokezer, Jorge',

'Yetazec, Jonathan']

ista_350_s15_R = ['Celukih, Felicia', 'Cozitik, Christian', 'Fogukoq, Cassidee', 'Gizoqof, Victor',

'Hutexav, Kelly', 'Jorevem, Haodong', 'Tikedax, Brennen', 'Toqoxiy, Matthew', 'Toyenad, Happy',

'Yuwuroh, Alan', 'Zufayod, Garrett']

conn = sqlite3.connect('classes_redacted.db')

self.assertEqual(ista_130_f17_A, get_students(conn, 'ISTA_130_F17', 'A'))

self.assertEqual(ista_350_s15_R, get_students(conn, 'ISTA_350_S15', 'R'))

self.assertEqual([], get_students(conn, 'ISTA_131_F17', 'T'))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!