Preview:
#Python program to create class,object and method.
class person: #class
    name = 'raju'
    age = 20
    def display (cls): #method
        print(cls.name)
        print(cls.age)
p=person() #object
p.display() #call the method using the instance
        
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter