def add_student(student_list, student):
student_list.append(student)
def remove_student(student_list, student_id):
student_list=[s for s in student_list if s['id']!=student_id]
return student_list
def update_student(student_list, student_id, new_info):
for student in student_list:
if student['id']==student_id:
student.update(new_info)
students=[
{'id':1, 'name':'Alice','age':20},
{'id':2, 'name':'Bob','age':22},
{'id':3, 'name':'Charlie', 'age':23}
]
update_student(students, 2, {'name':'Robert','age':23})
print(students)
new_student={'id':4,'name':'David', 'age':21}
add_student(students, new_student)
print(students)
students=remove_student(students,2)
print(students)