Question: Exercise 1b) Implement the decay parameter as a property 1p Turn the decay parameter a into a property. Implement a setter method that throws
Exercise 1b) Implement the decay parameter as a property 1p Turn the decay parameter a into a property. Implement a setter method that throws a ValueError if the provided value is negative. Use this setter method in the constructor and write a test function test negative_decay_raises_ValueError that verifies that the following code raises a ValueError: model ExponentialDecay (0.4) model.decay = -1.0 Hint - writing properties with private variables You can read about properties with getters and setters in the lecture notes on properties or in the slides on classes in Python.
Step by Step Solution
There are 3 Steps involved in it
class ExponentialDecay def initself value Constructor that takes an argument for decay para... View full answer
Get step-by-step solutions from verified subject matter experts
