Demo entry 6718578

123

   

Submitted by anonymous on Mar 05, 2018 at 08:59
Language: Python 3. Code size: 292 Bytes.

class Person:
    def __init__(self, name=None, age=None):
        self.name = name
        self.age = age
    
    def print_name(self):
        print('{0}'.format(self.name))


p1 = Person('hellen', '23')

p1.print_name()

print(p1.name)

p1.sex = 'female'

print(p1.sex)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).