+ 3
Any tips on Python classes?
I've been studying classes in python, but I'm having trouble fitting it into a larger picture. I'm trying to find ways to implement classes and oop into my programs. Any tips to gain a deep more intuitive understanding of python classes? Tutorials or explanations would be greatly appreciated.
1 Resposta
+ 3
Classes in python in the most simplest form, is an object that can have attributes attached to them. Think of it as a variable that can have multiple values. Their behavior is very similar to function. Of course there is much more to it than that. You can have special things happen like if one class object is added to another, you can specify what happens with that interaction (which is awesome). They do have rules and special features, but if you read the tutorials in Sololearn or any other guide, you'll be fine.
In other programming languages, classes are important and you need to learn them up front. Python lets you make them optional to your program. But they're powerful, and make your life easier in so many ways.
Here's an example use of classes I made for you.
https://code.sololearn.com/cx9d4m1brMG1