Python Forum
[split] Name error/is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Name error/is not defined
#1
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
Reply
#2
Split from https://python-forum.io/Thread-Name-erro...ot-defined
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 576 Nov-23-2023, 02:53 PM
Last Post: rob101
  [split] NameError: name 'csvwriter' is not defined. Did you mean: 'writer'? cathy12 4 3,302 Sep-01-2022, 07:41 PM
Last Post: deanhystad
  [variable] is not defined error arises despite variable being defined TheTypicalDoge 4 2,124 Apr-05-2022, 04:55 AM
Last Post: deanhystad
  Error 'Contour' not Defined DaveG 3 2,350 Mar-13-2022, 03:29 AM
Last Post: deanhystad
  Getting "name 'get_weather' is not defined error and no json_data returned? trthskr4 6 3,597 Sep-14-2021, 09:55 AM
Last Post: trthskr4
  [split] NameError: name 'start_with_first_selected' is not defined knoxvilles_joker 4 3,063 Apr-18-2021, 07:59 PM
Last Post: knoxvilles_joker
  Error when refering to class defined in 'main' in an imported module HeRo 2 2,376 Apr-13-2021, 07:22 PM
Last Post: HeRo
  Why does lambda throw 'name value_o is not defined' error? karabakh 3 2,180 Dec-14-2020, 05:45 PM
Last Post: karabakh
  name error "name"is not defined MaartenRo 1 3,424 Jul-28-2020, 02:39 AM
Last Post: bowlofred
  Name Error: name 'Stockton' is not defined Pinokchu 3 2,277 Jun-13-2020, 02:48 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020