diff --git a/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68420be9af9d89620af7944a.md b/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68420be9af9d89620af7944a.md index 527754f6940..5ce4c2adc95 100644 --- a/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68420be9af9d89620af7944a.md +++ b/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68420be9af9d89620af7944a.md @@ -144,13 +144,15 @@ class Wallet: return self.__balance acct_one = Wallet() -acct_one.deposit(4) # ValueError('Amount must be positive') -print(acct_one.get_balance()) # 0 +acct_one.deposit(3) +print(acct_one.get_balance()) # 3 acct_one.deposit(50) -print(acct_one.get_balance()) # 50 -acct_one.withdraw(-8) # ValueError('Amount must be positive') -acct_one.withdraw(58) # ValueError('Insufficient funds') +print(acct_one.get_balance()) # 53 + +acct_one.deposit(-4) # ValueError: Amount must be positive +acct_one.withdraw(-8) # ValueError: Amount must be positive +acct_one.withdraw(58) # ValueError: Insufficient funds ``` As you can see, the `__validate` method is private, and runs behind the scenes in the `deposit()` and `withdraw()` public methods to make sure the amount is always valid.