Python Forum

Full Version: [split] Name error/is not defined
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am having much in same error.I am new to this forum and python also if anyone can give me a working output of this code it would be much helpful

class employee():
    bs=0
def fx(self,bs):
        hra=0.4
        ta=0.1
        pf=0.1
        e=(bs+(bs+ta+pf))
        return e
def type1(self,tar,atar):
        bs=(atar-tar)*(self.bs*0.1)
        return bs
def type2(self,t,at):
        c=(t-at)*20
        return c
def total(self,fs,sb,pb):
        total=fs+sb+pb
        return total
class main():
    e=employee()
    print("Enter the base salary")
    bs=input()
if(type==1):


    print("Enter a and at")
    target=input()
    atarget=input()
    sb=e.type1(target,atarget)

else:
    print("Enter t and at")
    t=input()
    at=input()
    pb=e.type2(t,at)
    g=e.total(fs,sb,pb)
    print("the enter is ",g)

I am getting error which is

Error:
FILE:"employ.py",line 33, in <module> pb=e.type2(t,at) NameError: name 'e' is not defined