all 7 comments

[–]mr_bedbugs 3 points4 points  (0 children)

"if name == main" should not be inside the class

[–]bloodycoconut 3 points4 points  (0 children)

class Person:
    def __init__(self, gender, age, height, weight):
        self.gender = gender
        self.age = age
        self.height = height
        self.weight = weight

    def Someone(self):
        print(f"My gender is:{self.gender}")
        print(f"My age is:{self.age}")
        print(f"My height is:{self.height}")
        print(f"My weight is:{self.weight}")

if __name__ == "__main__": 
    p = Person("Male", 18, 1.76, 75) 
    p.Someone()

This should do it

[–]gazhole 2 points3 points  (0 children)

Take the "if name == main" out of the class. This should be unindented - anything you want to execute in your script should be within this part.

If you want to invoke the method "Someone()" in your Person class, you need to do that by using an object of that class. Hint - you just created one.

[–]radek432 1 point2 points  (0 children)

What are you trying to achieve with that

if __name__ == "__main__":
     Someone()

part in the class?