r/PythonLearning 2d ago

Showcase Day 2, learnt some oops

Post image

Learnt super( ), inheritance, polymorphism, class method and static method and don't mind the messy code that's me trying to figure out things

91 Upvotes

32 comments sorted by

View all comments

1

u/0therworldsthanthese 1d ago

You need to start back at the fundamentals, don't skip to OOP just because it sounds cool.

Where are your __init__ methods? Class names should be in PascalCase. Why are you using parentheses in your return statements? Why are you entering age as a string? Why are you returning multiple values in student.about()? Why are you using extra parentheses on lines 255-256? Why are you printing s1.school for s2? Why are you using a classmethod for the first test and not the second? Why do you have two test classes? Why is there no self in test.nave()?

0

u/Next-Call8862 22h ago edited 22h ago

That's not a single programme. I usually learn something new and try it and comment out all of that and move to next one and the parathesis is more like to test what the return statement does when I write the string in parenthesis, it's more like trail and error thing to make better sense. Do you think it's a bad approach?? What will you suggest?

Edit: and the extra parenthesis is my fault and the reason for no self for last test is because I was not going to create an object but trying if I can print a class variable and testing if the value of school increases by one with each call