Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
Can anyone tell me how to create a class in Python?

1 Answer

0 votes
by (108k points)
edited by

For creating the class in Python, all you need is a ‘class’ keyword that helps you to create the class in Python. Refer to the below code for creating a class and initializing a variable inside that class:

class MyClass:

  x = 5

If you are looking for an online course to learn Python, I recommend this Python Training program by Intellipaat.

Browse Categories

...