Question: Exercise 1g) - Implement custom exception 1p You should make sure that the provided initial guess u is a numpy array whose length is

Exercise 1g) - Implement custom exception 1p You should make sure that the provided initial guess ue is a

Exercise 1g) - Implement custom exception 1p You should make sure that the provided initial guess u is a numpy array whose length is equal to the number of states for the ODE model. If this is not the case you should raise a special error called Invalid Initial ConditionError that is a special type of RunTimeError. Hint - Creating special exceptions You can create a special exception by inheriting from an existing exception class. For example class Invalid Initial ConditionError (RuntimeError): pass Write one test called test solve_with_different_number_of_initial_states where you test that if you provide ue as a numpy array of length 2 then a Invalid InitialConditionError is raised.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Lets create a custom exception called Invalid InitialConditionError in Python This excepti... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!