Error occurs while running Module 5, Video 1 - Last program | Selenium Python Forum
G
Gaurav Valera Posted on 16/10/2019

-------------------

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()


G
Gaurav Valera Replied on 16/10/2019

Able to run it now.

Please mark it as resolved

thanks


G
Gaurav Valera Replied on 16/10/2019

Able to run it now.

Please mark it as resolved

thanks


0
09914040666 Replied on 19/10/2019

Thanks :)