3

This is my current class:

class abc:
    def __init__(self, a=0, b=0):
        self.c= c
        self.b = b
        self.a = a

    def type_func(self):
        type = raw_input("enter the type")
        if type == "A":
            self.b = 5
        else:
            self.b = 1
    #cab().register()

    def input(self):
        self.c = int(raw_input("enter c"))
    #cab().display()

    def display(self):
      print self.a,self.b*self.c

c = cab()

I want to call c.type_func() and then make the program automatically call input() and when that is done, call display().

How do I go about doing that ?

1 Answer 1

2

You can call the functions you want by simply adding self.

So to call input, you would call self.input() or for display call self.display(). The function will use the already instantiated object. Call this within the desired method of the class.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.