GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

program on classes in python

You were given a list of lists which consists 1st argument as T or S where T is
Teacher and S is Student, 2nd argument as Name, 3rd argument is age and then a
series of tuples(from 4th argument). If T is an first argument then only one tuple is
present in the list which have 2 arguments 1st is total number of students that a
teacher should calculate their marks and 2nd is total number of students that a
teacher calculated their marks. If S is an first argument then tuples have 2
arguments in each tuple where 1st argument is marks for a question and 2nd
argument is True (or) False (Which tells a question is wrong or not).
● Create a Person class where it have two attributes they are name, age and
profession. Methods are getters, setters and __str__.
● Create a Student class which inherits Person class where attributes are list of
tuples which comes from the given list and total marks. Methods are
   ○ calculate Marks()- F rom the list which has tuples calculate total marks
if tuple has True.
   ○ Getters and setters
   ○ __str__ - Which returns a person object + total marks obtained
● Create a Teacher Class which inherits Person class where attributes are tuple
which is present in the given list and nCNS(number of students that a teacher
not calculated their marks) . Methods are
   ○ Calculate number of students that a teacher has to calculate their
marks
   ○ __str__ - Which returns person object + nCNS
Now Print all the objects
Example:

Input -
[ [T, “Deekshith”, 24, (15,14)], [S, “Madhav”, 8, (1,True), (2,False), (1,True), (2, True)], [
S, “Venky”, 8, (2,True), (1,False), (1,True), (2, True)], [T, “Murthy”, 23, (12,10)] ]
Output -
Deekshith 24 Teacher 1
Madhav 8 Student 4
Venky 8 Student 5
Murthy 23 Teacher 2

asked Jul 29, 2016 by anonymous
...