python make class object code example
Example 1: class in python
class LuckyLemur():
def __init__(self, description):
self.description = description
def reveal_description(self):
print(f'Lucky Lemur is {self.description}')
lucky_lemur = LuckyLemur('Pro')
lucky_lemur.reveal_description()
Example 2: how to define a class in python
class a_class:
def __init__(self, input1):
self.__input1 = input1
def return_input(self):
return self.__input1
a_class_object = a_class("input string")
print(a_class_object.return_input())