---
title: "Class in Python?"  
description: "Class in Python?"  
author: "Anonymous User"  
published: 2018-07-20  
updated: 2018-07-20  
canonical: https://www.mindstick.com/forum/34630/class-in-python  
category: "python"  
tags: ["python"]  
reading_time: 1 minute  

---

# Class in Python?

What is a [Class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp)? How do you create it in [Python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?

## Replies

### Reply by Prakash nidhi Verma

A class is a template of code and collection of objects that has same set of attributes and behaviour. To create a class use the keyword class followed by class name beginning with an uppercase letter.

A company belongs to class called company class and can have the attributes say first-name and last-name and behaviour methods say showFullName().

Ex :

```
class Person(): #method
def inputName(self,fname,lname): self.fname=fname self.lastname=lastname
#method
def showFullName() (self):
print(self.fname+" "+self.lname)person1 = Person() #object instantiation person1.inputName

("Mindstick","Software") #calling a method inputName person1. showFullName() #calling a method

showFullName()
```

you can define a method inside a class the first argument to the method must be self where self – is a pointer to the class instance. self must be passed as an argument to the method, though the method does not take any arguments.


---

Original Source: https://www.mindstick.com/forum/34630/class-in-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
