Home >>Python Keywords >Python class Keyword

Python class Keyword

Python class Keyword

Python class keyword is used to create a class.

A class is like an object constructor. Through the class , a new user-defined type is introduced into the Program.

Here is an example of Python class keyword:

class Person:
  name = "Jerry"
  age = 21
print(Person.name)

Output:
Jerry
Example 2:

class Person:
  name = "Jerry"
  age = 21
p1 = Person()
print(p1.name)

Output:
Jerry

Popular Tutorials