0% found this document useful (0 votes)
2 views1 page

Python Account Code

The document contains a Python class named 'Account' that simulates basic banking operations such as debit and credit transactions. It initializes an account with a balance and account number, allows for debiting and crediting amounts, and provides a method to retrieve the current balance. An instance of the Account class is created and demonstrates these functionalities with example transactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Python Account Code

The document contains a Python class named 'Account' that simulates basic banking operations such as debit and credit transactions. It initializes an account with a balance and account number, allows for debiting and crediting amounts, and provides a method to retrieve the current balance. An instance of the Account class is created and demonstrates these functionalities with example transactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

print("Try programiz.

pro")
class Account:
def __init__(self,bal, acc):
self.balance = bal
self.account_no = acc

def debit(self,amount):
self.balance = self.balance - amount
print("hi","Rs", amount, "has been deducted from your account no:",self.account_no , "r

def credit(self,amount) :
self.balance = self.balance + amount
print ("Rs",amount, " credited to " , self.account_no, ",updated balance: ", self.balan

def get_balance(self) :
return self.balance

cust1 = Account(10000, 112233)


print(cust1.balance)
print(cust1.account_no)
cust1.debit(1)
cust1.credit(2)
print(f"final balance : {cust1.get_balance()}")

You might also like