provide for changing attributes by defining setter methods sometimesan attribute has to be changed completely assumefor tax reasonsit is preferable for stefan to change the account holder to its wife because we said that assigning value to an attribute from the outside like stefansacc holder "andreais bad stylewe provide setter method for this case class account(object)'' class representing an account ''def set_holder(selfperson)self holder person main part of the program execution starts hereif __name__ ="__main__"stefansacc account( "stefan"stefansacc deposit( stefansacc set_holder("andrea"stefansacc print_info(in the above codethe setter method simply sets the object' attribute to the given value this may seem superfluous at the momentand there are actually other (saferways to do this in python (keywordpropertieshoweverfor nowwe go along with the python programming principle of trusting the code that uses your classes and stick to the following rules in order not to violate the data encapsulation paradigm assign values to attributes only via instance methods (settersor the constructor modify the values of attributes only via instance methods accessing (readingthe value of attributes like print(stefansacc balanceis okay so what good is thatfor instanceinside the setter methodswe can validate the new valueor raise an exception if the new value is not valid the new value for the account holder attribute has to be name or at least non-empty string that contains only letters and spaces we could hence write the setter method like this def set_holder(selfperson)if (not type(person=str)raise typeerror if not re match("\ +\ +)*"person strip())raise valueerror self holder person annemarie friedrichcis lmu munchenws /