Skip to content

Commit bccae37

Browse files
committed
Update readme
1 parent 3d826ba commit bccae37

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ OOP is the programming paradigm where the real-life object is at the center of a
2828

2929
- [Reason for creating a class](https://github.com/CodingMantras/python-class-tutorial#reason-for-creating-a-class)
3030

31-
- [Naming a 'class'](https://github.com/CodingMantras/python-class-tutorial#naming-a-class)
32-
3331
- [`class` keyword and `__init__` method](https://github.com/CodingMantras/python-class-tutorial#class-keyword-and-init-method)
3432

33+
- [Naming a 'class'](https://github.com/CodingMantras/python-class-tutorial#naming-a-class)
34+
3535
- [Instance of a class](https://github.com/CodingMantras/python-class-tutorial#instance)
3636

3737
- [Attributes & Methods](https://github.com/CodingMantras/python-class-tutorial#attributes-and-methods)
@@ -80,8 +80,6 @@ To name a `class` in Python the convention is to start with capital letter like:
8080
## class keyword and __init__ method
8181
Everything in Python is a class. like **list**, **int**, **str**, **tuple**, **functions**, **sys** etc. To create a user defined object we use **class** keyword in Python. The special method **__init__** is used to initialize an object of that class.
8282

83-
---
84-
8583
### An example of a `Car class`:
8684
Let's say, we need to create a record of cars manufactured by the Tata Motors. The data and data related to car are as mentioned below.
8785

@@ -95,7 +93,6 @@ Year = 2022
9593
|Harrier|Black|180| December|
9694
|Harrier|Dark Grey|180| December|
9795

98-
9996
**A table containing details of each Car. The row of this table represents the each instance of a class and columns represents attributes associated with an instance of the Car class**.
10097

10198
For this we will create the Car class in Python like below:
@@ -170,8 +167,6 @@ print(car.name)
170167
print(car.speed)
171168
```
172169

173-
---
174-
175170
### Class variables:
176171
The variables associated with all the the instances of a class. They are shared by all the instances of that class.
177172

@@ -232,6 +227,8 @@ We use @classmethod decorator to tell python that it is a classmethod. By doing
232227

233228
### Static method
234229

230+
---
231+
235232
## Helpful In-build Methods:
236233
### dir(): List all the data and methods associated with `instance car1` and `class Car`.
237234
```python
@@ -324,6 +321,8 @@ print(Animal.__dict__)
324321
{'__module__': '__main__', '__init__': <function Animal.__init__ at 0x7f295e98ef70>, '__str__': <function Animal.__str__ at 0x7f295e935040>, 'walk': <function Animal.walk at 0x7f295e9350d0>, 'jump': <function Animal.jump at 0x7f295e935160>, 'speak': <function Animal.speak at 0x7f295e9351f0>, '__dict__': <attribute '__dict__' of 'Animal' objects>, '__weakref__': <attribute '__weakref__' of 'Animal' objects>, '__doc__': None}
325322
```
326323

324+
---
325+
327326
## OOPs concepts:
328327

329328
### Inheritance

0 commit comments

Comments
 (0)