The class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The class

I didn't understand the concept of class in python. Do somebody can give me a clue

11th Oct 2022, 12:28 AM
Phill Edzang
Phill Edzang - avatar
2 Answers
+ 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.
11th Oct 2022, 12:44 AM
Amirreza
Amirreza - avatar
+ 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.
11th Oct 2022, 5:23 AM
Tibor Santa
Tibor Santa - avatar