Python
Python copied to clipboard
🚀 Learning Python – Object-Oriented Programming (OOP) Today I practiced a simple BankAccount class in Python using OOP concepts. 🔑 Concepts used: Class and Object Constructor (__init__) Encapsulation (private variable __account_number) Methods This helped me understand how real-world objects like a bank account can be modeled using Python. Excited to keep learning and improving my Python skills! 💻🐍 #Python #OOP #LearningPython #Programming #Beginner #AIML #Student
class BankAccount: def init(self,account_number,balance): self.__account_number = account_number self.balance = balance
def check_balance(self):
print("your account number is : ",self.__account_number)
print("your available balance is :" ,self.balance)
b = BankAccount(281207,27000) b.check_balance()