From 0e9f97c5812379fc730ed415a4eb2591ee17176e Mon Sep 17 00:00:00 2001 From: Jeevankumar S <110320697+Jeevankumar-s@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:56:23 +0530 Subject: [PATCH] fix(curriculum): correct validation example in encapsulation lesson (#64906) Co-authored-by: Jeevankumar --- .../68420be9af9d89620af7944a.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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.