0% found this document useful (0 votes)
3 views1 page

Python Assignment 4

This document outlines an assignment for a B.Tech. course in Python Programming, detailing tasks across three sections. Section A includes definitions and explanations of basic Python concepts, Section B covers regular expressions and inheritance, and Section C requires the development of Python programs involving class definitions and regular expressions. The assignment is structured to assess understanding and application of Python programming principles.
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 views1 page

Python Assignment 4

This document outlines an assignment for a B.Tech. course in Python Programming, detailing tasks across three sections. Section A includes definitions and explanations of basic Python concepts, Section B covers regular expressions and inheritance, and Section C requires the development of Python programs involving class definitions and regular expressions. The assignment is structured to assess understanding and application of Python programming principles.
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

[Link].

(Computer Science and Engineering)


Semester–IV
Subject: Python Programming (BCO081B)
Marks: 64
Assignment #4

Section–A (5×2 = 10 Marks)

1. Define a class and an object with an example.


2. What is the use of the self parameter in Python classes?
3. Differentiate between constructor (__init__()) and destructor (__del__()).
4. Explain private variables in Python with an example.
5. What is the purpose of using raw strings (r"") in regular expressions?

Section–B (7×3=21 Marks)

1. Explain the role of parentheses in regular expressions with an example. Demonstrate


the use of [Link]() method for pattern matching.
2. Explain different types of inheritance in Python with examples.
3. Write a Python program that uses named groups in regular expressions to extract a
username and domain from an email address.

Section–C (11×3 = 33 Marks)

1. Define a class Employee with attributes name, salary, and a method show_details().
Inherit a subclass Manager that adds a department attribute and overrides the method to
display all details.
2. Write a Python program that takes a string containing multiple phone numbers and
uses regular expressions to extract all valid 10-digit numbers.
3. Develop a Python program that defines a class with both public and private methods.
Demonstrate accessing the private method through a public method.

You might also like