0
The class
I didn't understand the concept of class in python. Do somebody can give me a clue
2 ответов
+ 2
understand it.
In Python, a class is a template for creating objects. Objects created from the same class will have the same attributes and methods.
+ 2
Classes are the key building blocks of object-oriented programming.
We write programs to solve specific real life problem. We can use classes to create a model of this reality in the programming space. Classes usually represents "things" and their relationships. The fields or attributes of a class, are variables that store certain important data about a class. The methods (functions) of a class, define the behaviour what is closely related to the class.
For example if you want to code a school logbook, you would represent lessons, students, teachers as classes (in programming sense). Grades, student names would be an attribute in one of those classes. And logging an absence from the lesson, or writing a test would be expressed as methods.