0% found this document useful (0 votes)
3 views

5 _ 6module

Pyhon module

Uploaded by

kagwadeashok5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

5 _ 6module

Pyhon module

Uploaded by

kagwadeashok5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: Akanksha Ashok Kagwade

Batch: A1

Roll No: 03

Assignment No:- 05
Program:
def add (a,b):

"""Returns the sum of two number."""

return a+b

def subtract(a,b):

"""return the difference of two number"""

return a-b

def multiply (a,b):

"""return the product of two number."""

return a*b

def divide (a,b):

"""return the quotient of two numers."""

if b==0:

return "cannot divide by zero!"

return a/b
Program:

import math_operations as mo

sum_result=mo.add(10,5)

difference=mo.subtract(10,5)

product=mo.multiply(10,5)

quotient=mo.divide(10,5)

print("sum",sum_result)

print("difference",difference)

print("product",product)

print("quotient",quotient)

print("divided by zero",mo.divide(10,0))

Output:-
Name: Akanksha Ashok Kagwade

Batch: A1

Roll No: 03

Assignment No:- 05
Program:
class Person:

def __init__(self, name, age):

self.name = name

self.age = age

def introduce(self):

print(f"Hi, my name is {self.name} and I am {self.age} years old.")

class Student(Person):

def __init__(self, name, age, student_id):

super().__init__(name, age)

self.student_id = student_id

def introduce(self):

super().introduce()

print(f"My student ID is {self.student_id}.")

person1 = Person("Alice", 30)


person1.introduce()

student1 = Student("Bob", 20, "S12345")

student1.introduce()

Output:-

You might also like