Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Constructors : Welcome Message with Student Name.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ To write a Python program that creates a **Student** class with a **default cons
5. **Execute the Program**: Instantiate the `Student` class and call the `show` method.

## 🧾 Program
```
class Student: def init(self,name,userid): self.name=name self.userid=userid self.display()
def display(self): print(self.userid) name=input() userid=input() obj =
Student(name,userid) obj.display()
```

Add code here

## Output
<img width="414" height="162" alt="image" src="https://github.com/user-attachments/assets/e1f103ab-74a9-4b48-b59d-23407eb2bf90" />

## Result
The Python program that creates a Student class with a default constructor,which will
take the name and userid of the person as parameters print the userid of the person.
13 changes: 12 additions & 1 deletion Destructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,20 @@ The program defines a class `Demo` with:
- Create an instance of the `Demo` class.
- Delete the object using the `del` keyword.
## Program
Add code Here
```
class Demo:
def __init__(self):
print("Alive")
def __del__(self):
print("The object no longer exists")
obj=Demo()
del obj
```

## 🧪 Output
<img width="410" height="120" alt="image" src="https://github.com/user-attachments/assets/98e05ad0-c633-430d-999f-e56c3261feaf" />

## Result
This project demonstrates how to implement a destructor in Python using a simple class
is executed sucessfully.

49 changes: 48 additions & 1 deletion Heirarchical_Inheritence.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,53 @@ To write a Python program that uses **Hierarchical Inheritance** to input and di
5. Display collected information using class methods.

## Program
Add code here
```
class Details:
def __init__(self, name, age):
self.name = name
self.age = age
def getName(self):
return self.name
def getAge(self):
return self.age
class Employee(Details):
def __init__(self, name, age, employee_id, department):
super().__init__(name, age)
self.employee_id = employee_id
self.department = department
def getEmployeeDetails(self):
print("Employee Information:")
print("Name:", self.getName())
print("Age:", self.getAge())
print("Employee ID:", self.employee_id)
print("Department:", self.department)
class Patient(Details):
def __init__(self, name, age, patient_id, disease):
super().__init__(name, age)
self.patient_id = patient_id
self.disease = disease
def getPatientDetails(self):
print("Patient Information:")
print("Name:", self.getName())
print("Age:", self.getAge())
print("Patient ID:", self.patient_id)
print("Disease:", self.disease)
emp_name = input()
emp_age = int(input())
emp_id = input()
emp_dept = input()
employee = Employee(emp_name, emp_age, emp_id, emp_dept)
11/20/25, 6:12 PM Module-5/Heirarchical_Inheritence.md at main · kirupa169/Module-5
https://github.com/kirupa169/Module-5/blob/main/Heirarchical_Inheritence.md 2/3
The program is successfully excexuted
pat_name = input()
pat_age = int(input())
pat_id = input()
pat_disease = input()
patient = Patient(pat_name, pat_age, pat_id, pat_disease)
employee.getEmployeeDetails()
patient.getPatientDetails()
```
## Sample Output
<img width="417" height="322" alt="image" src="https://github.com/user-attachments/assets/1502d2e4-7b38-4eea-969b-4cdfd3894524" />

17 changes: 16 additions & 1 deletion Multilevel_Inheritence.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@ To write a Python program that uses multilevel inheritance to get and display a
- Print all details using class methods.

## Program
Add code here
```
class student:
def __init__(self,x,y,z):
self.x=x
self.y=y
self.z=z
class s(student):
def show(self):
print(f"{self.x} {self.y} {self.z}")
x=input()
y=int(input())
z=int(input())
obj=s(x,y,z)
obj.show()
```

## Sample Output
<img width="425" height="169" alt="image" src="https://github.com/user-attachments/assets/4d67bfb4-291c-4c41-b489-cab7d3fc012e" />

25 changes: 24 additions & 1 deletion Multiple Inheritence.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ To write a Python program to calculate **Add, Sub & Division** using **Multiple
- Display the results of the three operations.

## 💻 Program
Add code here
```
class Calculation1:
def Summation(self, a, b):
return a + b
class Calculation2:
def multi(self, a, b):
return a * b
class Derived(Calculation1, Calculation2):
def Division(self, a, b):
if b != 0:
return a / b
else:
return "Division by zero is not allowed"
num1 = float(input())
num2 = float(input())
obj = Derived()
sum_result = obj.Summation(num1, num2)
mul_result = obj.multi(num1, num2)
div_result = obj.Division(num1, num2)
print(sum_result)
print(mul_result)
print(div_result)
```
## Output Example
<img width="422" height="262" alt="image" src="https://github.com/user-attachments/assets/76ccdf24-08c3-4de9-83c5-da5453af3cd1" />