Question: Continue working on your Lab 7 , in this lab, we need to modify some methods - Instead of having them return True / False

Continue working on your Lab 7, in this lab, we need to modify some methods - Instead of having them return True/False, modify each one to throw an exception if invalid data is passed. In other words, you just need to modify predefined methods to throw an exception when "False". Here are some sample code:
def set_office_number(self, x):
if x <100 or x >500:
raise ValueError
else:
self.office_number = x
In terms of set_name, replace("_","") can be used to remove specific characters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!