Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

simple python class

class Person:
    def say_hi(self):
        print('Hello, how are you?')

p = Person()
p.say_hi()
# The previous 2 lines can also be written as
# Person().say_hi()
Source by python.swaroopch.com #
 
PREVIOUS NEXT
Tagged: #simple #python #class
ADD COMMENT
Topic
Name
7+6 =