manipulate attributes only via instance methods it was said earlier that assigning value to an object' attribute like this is bad stylestefansacc balance in oopan important principle is the one of data encapsulationwhich means that the attributes of an object should be 'hiddenfrom manipulations from 'outside( from the code that uses the objectthe attributes of an object should only be modified using code that was written within the class definition this ensures that the state of the object is always valid imaginestefan' account balance is $ and he wants to withdraw $ howeverstefan' account has the restriction that it may not have negative balance assume the (humanteller at the bank forgets about this restrictionsets the balance manually to -$ and hands the cash to stefan you can imagine that this would make the branch manager of the bank quite unhappy when he realizes that stefan' account is in state that is not allowed the withdraw(selfamountmethod modifies the balance attributebut we can control this manipulation in the method for instancewe could prohibit withdrawals that would result in negative balance class account(object)'' class representing an account ''methods def withdraw(selfamount)if amount self balanceamount self balance self balance -amount return amount main part of the program if __name__ ="__main__"annesacc account( "anne"annesacc deposit( print("trying to withdraw :"cash annesacc withdraw( print("yeahi got:"cash print("trying to withdraw :"cash annesacc withdraw( print("oh noi only got:"cash annemarie friedrichcis lmu munchenws /