python class create object code example
Example 1: how to make a class in python
class Person:
def __init__(self, _name, _age):
self.name = _name
self.age = _age
def sayHi(self):
print('Hello, my name is ' + self.name + ' and I am ' + self.age + ' years old!')
p1 = Person('Bob', 25)
p1.sayHi() # Prints: Hello, my name is Bob and I am 25 years old!
Example 2: class python example
# If questions ask SK3#3160 he can help you i think
def ok(index):
print(index) > Hi!
ok("Hi!")
class Lib:
def ok(self,Token):
print(Token) > Hello World!
Library = Lib()
Library.ok("Hello World!")