Question: solve python The following list is created to store the student abyectsi ncudenterat=11 To add a student to this Jist, the fallowing function has uo
The following list is created to store the student abyectsi ncudenterat=11 To add a student to this Jist, the fallowing function has uo be used. The implinfentation of thin function is hiddern. det Bdastwant fatip, list i . Crdetaile ife hliders This function adds a new student to a given list under two corvitions! 1. If there exists NO student with the same name and sumame, or 2. If there exists NO student with the same id If one of these conditions fail, then this function does not do anything. Belaw is a sample code where: several student objects are created and fddstisdent is ured to insert these objects into sir tucentilist. a1.-Stadentr1,*stek",mDayid""maryciey=,21Rudelstadent(3.,studentletat)az-9tvdent(2,fJack","D-svid*,"blmieaota*,4)RddStudent(A2k.studentLatst) Adiastudent lin 3. studerti.tat) With the code above, only Jack David with 1d - 2 will be inserted to the list, since the other two records does not satisfy the conditions, as you may see in the output below: for x in atudenttist: print (x) Output: [1] Jack David Your task is to write the same program by using dictionary instead of class, which means you need to revise Part 1, Part 2 and Part 3. There should not be any definition of a class in the new program. Students should be created as dictionary items. studentilst should be used to keep these dictionary items. You should also write the full implementation of the RddStudent function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
