i have a list of until 3 items each item have a list of until 5 items. i need to replace 2 items from another lists. i get only the strings to change. without return anything for example: i have a class School that have a list of Class [size<=3]. and each class have a list of Student [size<=5] i get two "name"s of Students, i need to search them in School by running on all Classes and all Students and swap them. The Student class have a "name" field. especially if their are not in same ClassRoom
class Student:
def __init__(self, id, name):
self.name = name
self.id = id
class ClassRoom:
def __init__(self):
self.Students[]
class School:
def __init__(self):
self.classes = []
def swap(self, name1, name2):
#???
scl.classes = [c1,c3]
s2 = Student(2,"John")
s6 = Student(6, "Ben")
c1.students = [s1,s2,s3]
c3.students = [s1,s4,s6]
scl.search_replace("John", "Ben")
thanks