-------------------
Error description:
-------------------
Traceback (most recent call last):
File "C:\Users\heaven1\eclipse-workspace\Module5\module5\import2.py", line 8, in <module>
b.deposit(70)
File "C:\Users\heaven1\eclipse-workspace\Module5\module5\classes.py", line 11, in deposit
self.acccountbalance=self.accountbalance + deposit
AttributeError: 'Banks' object has no attribute 'accountbalance'
Program:
----------------------------
Modulename: Classes.py
----------------------------
class Banks:
def __init__(self,accountbalance):
self.acccountbalance=accountbalance
def deposit(self,deposit):
self.acccountbalance=self.accountbalance + deposit
def withdraw (self,withdraw):
self.acccountbalance=self.acccountbalance - withdraw
def checkbalance(self):
print(self.acccountbalance)
-----------------------------
Modulename: Import2.py
-----------------------------
from module5.classes import *
b=Banks(100)
b.deposit(70)
b.withdraw(50)
b.checkbalance()
Able to run it now.
Please mark it as resolved
thanks
Able to run it now.
Please mark it as resolved
thanks
Thanks :)