Basaveshwar Engineering College, Bagalkote
Department of Electrical and Electronics Engineering
Subject : Introduction to Python Programming Subject Code :
Faculty Name : Mr. Mahantesh Chikkadesai Semester : 3
Module-5
1. Explain the methods __init__ and __str__ with suitable code example to each.
2. Explain the program development concept ‘prototype and patch’ with suitable
example.
3. Define a function which takes TWO objects representing complex numbers and
returns new complex number with a addition of two complex numbers. Define a
suitable class ‘Complex’ to represent the complex number. Develop a program to read
N (N >=2) complex numbers and to compute the addition of N complex numbers.
4. Explain the following with syntax and suitable code snippet: i) Class definition ii)
instantiation iii) passing an instance (or objects) as an argument iv) instances as return
values.
5. Define pure function and modifier. Explain the role of pure functions and modifiers in
application development with suitable python programs.
6. create a Time class with hour, min and sec as attributes. Demonstrate how two Time
objects would be added.
7. What is a class? How to define a class in python? How to initiate a class and how the
class members are accessed? Explain with programming snippets
8. Define a class and object, construct the class called rectangle and initialize it with
height 100, width=200, starting point as (x = 0, y = 0). Write a program to display the
center point co-ordinates of a rectangle.
9. Explain the concept of copying using copy module with an example.
10. Explain the concept of inheritance with an example.
11. Briefly explain the printing of objects with an examples.