xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to inherit a class in Python
Python Online Editor
Execute Code
More Python Sample Codes
# Declaring person class class Person: def __init__(self): self.Name = "" self.Age = 0 # Declaring Student class class Student(Person): # Inheriting Person class def __init__(self): super().__init__() self.StudentId = 0 # Create a Student object studentObj = Student() studentObj.Name = "John" studentObj.Age = 15 studentObj.StudentId = 11 print(studentObj.Name + " is " + str(studentObj.Age) + " years old. His student id is " + str(studentObj.StudentId) + ".")