Python Pro
OOP → DSA + DP
reset progress
explore all
All
Basics
OOP
DSA
Trees
Graphs
DP
Algo
Advanced
0%
Encapsulation
⭐ 0/0
Bundling data & methods
📖 definition
Encapsulation bundles data and methods into a single unit, restricting direct access.
class
BankAccount
:
def
__init__
(
self
, balance):
self
.
__balance
= balance
Quick Quiz
What is encapsulation?
Check Answer
Code Runner
# Try your Python code here!\nprint("Hello, Python!")
Run
Reset
▶ Run your code to see output
🔐 secret inner vault
# advanced example
reveal secret
hide vault