---
title: "Object / class in python"  
description: "Object / class in python"  
author: "Anonymous User"  
published: 2018-07-04  
updated: 2018-07-04  
canonical: https://www.mindstick.com/forum/34580/object-class-in-python  
category: "python"  
tags: ["python"]  
reading_time: 1 minute  

---

# Object / class in python

[Define](https://yourviews.mindstick.com/audio/1110/lifestyles-choices-that-define-our-lives) and [Objects](https://www.mindstick.com/forum/145447/what-are-objects) and [Class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) with example in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python) ?

## Replies

### Reply by Prakash nidhi Verma

Python Classes/Objects :

Python is an object oriented programming language(Oop's concept). Almost everything in Python is an object,with methods.

Create a Class:

```
class MyClass:   x = 5
```

Create Object:

```
p1 = MyClass() print(p1.x)
```

Object Methods:

Objects can also contain methods. Methods in objects are functions that belongs to the object.

class Person:

```
 def __init__(self, name, age):     self.name = name
    self.age = age

   def myfunc(self):
    print("Hello my name is " + self.name)
p1 = Person("Prakash", 19)
p1.myfunc()
```


---

Original Source: https://www.mindstick.com/forum/34580/object-class-in-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
