OOP & Design Patterns - Prototype Pattern - Deep Copy vs Shallow Copy
Consider the following Python code snippet:
What will be the output of this code?
import copy
class Student:
def __init__(self, name, grades):
self.name = name
self.grades = grades
original = Student('Alice', [90, 85])
copied = copy.deepcopy(original)
copied.grades.append(95)
print(original.grades)What will be the output of this code?
