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

Lab Assignment 10 G3

The document outlines a Python lab assignment consisting of ten programming tasks. These tasks include set operations, string manipulation, file handling, and class design for various scenarios like clubs, student information, and animals. The assignment aims to enhance skills in data structures, file I/O, and object-oriented programming in Python.
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)
2 views1 page

Lab Assignment 10 G3

The document outlines a Python lab assignment consisting of ten programming tasks. These tasks include set operations, string manipulation, file handling, and class design for various scenarios like clubs, student information, and animals. The assignment aims to enhance skills in data structures, file I/O, and object-oriented programming in Python.
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/ 1

Python Lab Assignment

1.​ Write a program that takes two sets from the user and checks if one set is a subset
of the other.
2.​ There are two clubs: Dance Club, Arts Club and Music Club. Each has a different
list of member names.​
Write a program to:
●​ Find members in all three of the clubs
●​ Find members who are in only one club
●​ Find members who are in at least two clubs
●​ Find members only in Dance Club
●​ Find members only in Arts Club
●​ Find members only in Music Club
3.​ Write a program to count the occurrences of characters in a string and store the
output in a dictionary. E.g: input_string = “hello world”
Output: {‘h’: 1, ‘e’: 1, ‘l’: 3, ‘o’: 2, ‘w’: 1, ‘r’: 1, ‘d’: 1}
4.​ Write a function to find the value associated with the maximum key in a dictionary of
integers.
5.​ Write a program that collects student information(Name, Id, Dept) from the user and
stores each piece of information on a new line in a text file named students.txt.
6.​ Write a program that reads data from source.txt and writes it to a new file named
destination.txt in reverse order (i.e last line first, and so on)
7.​ Write a program that reads a file, counts the frequency of each word, and stores
them in a dictionary.
8.​ Design a class called Rectangle that accepts length and width as attributes.
Implement methods to calculate and return the area and perimeter of the rectangle.
After creating an object, display the area and perimeter values.
9.​ Create a class BankAccount with attributes: account_number, owner, balance.
Implement methods: deposit(amount) , withdraw(amount), display_balance()
Demonstrate each method with appropriate object calls.
10.​Create a base class Animal with attributes: name and species. Implement a method
display_info() that prints the animal’s name and species. Then, create a derived
class Dog that inherits from Animal and adds an additional attribute breed.
Instantiate the Dog class, set values for the name, species, and breed, and then
call the display_info() method from the base class to display the animal's
information along with the breed.

You might also like