python defining a class variable code example

Example 1: declare class python

# To create a simple class:
class Shape:
  	def __init__():
      	print("A new shape has been created!")
      	pass
    
    def get_area(self):
		pass

# To create a class that uses inheritance and polymorphism
# from another class:
class Rectangle(Shape):
  
	def __init__(self, height, width): # The constructor
    	super.__init__()
        self.height = height
    	self.width = width

	def get_area(self):
      	return self.height * self.width

Example 2: how to define a class in python

class a_class:
  #This initalizes the object, and is executed when you define
  #a new object in the class
  def __init__(self, input1):
    self.__input1 = input1
    
  #This is a function of the object that can be called
  def return_input(self):
    return self.__input1
  
a_class_object = a_class("input string")
print(a_class_object.return_input())