Change the price when cloning
Input
make_product_and_clone('Apple', 1.2, {'price': 2.0})
Output
('Apple', 1.2, 'Apple', 2.0)
The clone has the same name but the price override was applied to the new instance.
Full lesson preview
Implement a class method that produces a new instance by copying an existing one and applying specified attribute changes.
Problem statement
Task
Examples
Input
make_product_and_clone('Apple', 1.2, {'price': 2.0})
Output
('Apple', 1.2, 'Apple', 2.0)
The clone has the same name but the price override was applied to the new instance.
Input format
Output format
Constraints
Samples
Input
make_product_and_clone('Pen', 0.5, {'name': 'Blue Pen'})
Output
('Pen', 0.5, 'Blue Pen', 0.5)
Name changed on the clone while price stayed the same.