What is oops concept in python | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is oops concept in python

29th Nov 2018, 3:16 AM
Sanjay yadav
Sanjay yadav - avatar
2 Respostas
+ 1
The primitive data structures available in Python, like numbers, strings, and lists are designed to represent simple things like the cost of something, the name of a poem, and your favorite colors, respectively. What if you wanted to represent something much more complicated? For example, letā€™s say you wanted to track a number of different animals. If you used a list, the first element could be the animalā€™s name while the second element could represent its age. How would you know which element is supposed to be which? What if you had 100 different animals? Are you certain each animal has both a name and an age, and so forth? What if you wanted to add other properties to these animals? This lacks organization, and itā€™s the exact need for classes. Classes are used to create new user-defined data structures that contain arbitrary information about something. In the case of an animal, we could create an Animal() class to track properties about the Animal like the name and age. Itā€™s important to note that a class just provides structureā€”itā€™s a blueprint for how something should be defined, but it doesnā€™t actually provide any real content itself. The Animal() class may specify that the name and age are necessary for defining an animal, but it will not actually state what a specific animalā€™s name or age is. It may help to think of a class as an idea for how something should be defined.
29th Nov 2018, 6:31 AM
meenal deshpande
0
It's object oriented programming languages that work perform like object.
18th Jan 2019, 7:03 PM
Sanjay yadav
Sanjay yadav - avatar