0

I am trying to run this code but getting an error: Error I am facing

My code:

class Student:
    def __init__(self, student_id, marks,age):
       self.student_id=student_id
       self.marks=marks
       self.age=age

    def validate_age(self):
        if self.age >20:
            return True
        else:
            return False
    def validate_marks(self):
        if self.marks>0 and self.marks<100:
            return True
        else:
            return False
    def check_qualification(self):
        if (validate_age)==True and if(validate_marks)==True:
            if self.marks>65:
                return True
            else:
                return False
    def set(self,x):
        self.__student_id=x

    def get(self):
        if (check_qualification==True):
            return True
        else:
            return False
1
  • 2
    Please include your complete error traceback as text in the question itself and edit the formatting of your code. Commented Aug 10, 2019 at 9:42

1 Answer 1

4

It looks to me like you could just change the line

if (validate_age)==True and if(validate_marks)==True:

to

if self.validate_age() and self.validate_marks():

Note that, since those functions already return booleans, it's redundant to add == True. It's enough to simply call the functions.

You'll probably also have to change the line in get()

if (check_qualification==True):

to

if self.check_qualification():

The compiler is getting confused because you're not actually calling the functions in your code.

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.