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

Python Programs for Data Structures

The document outlines various Python programming tasks, including merging dictionaries, finding the second largest number, counting character types in a string, checking for palindromes, managing student details in a nested dictionary, flattening a nested list, counting word frequency, removing duplicates from a list, converting tuples to lists, sorting dictionary items, sorting user-input strings by length, and demonstrating shallow vs deep copy of lists.

Uploaded by

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

Python Programs for Data Structures

The document outlines various Python programming tasks, including merging dictionaries, finding the second largest number, counting character types in a string, checking for palindromes, managing student details in a nested dictionary, flattening a nested list, counting word frequency, removing duplicates from a list, converting tuples to lists, sorting dictionary items, sorting user-input strings by length, and demonstrating shallow vs deep copy of lists.

Uploaded by

reejuroy.sap2018
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

 Write a Python program to merge two dictionaries and print the resultant dictionary.

 Given a list of integers, write a Python program to find the second largest number
without using built-in functions like sorted() or max().

 Write a Python function that takes a string and returns the count of uppercase,
lowercase, digits, and special characters in it.

 Create a Python program that checks whether a given string is a palindrome (reads
the same backward and forward), ignoring case and spaces.

 Write a program to create a nested dictionary to store students’ details (name, roll
number, marks). Write functions to add, update, and retrieve student data.

 Write code to flatten a nested list into a single list using iteration (without recursion).

 Implement a program to count the frequency of each word in a given sentence and
store it in a dictionary.

 Write a Python program to remove duplicate elements from a list while maintaining
the original order.

 Given a tuple of integers, write a program to convert it to a list, modify an element,


and convert it back to a tuple.

 Write a function that takes a dictionary and returns a sorted list of tuples based on
the dictionary’s values.

 Create a program that accepts multiple strings from the user, stores them in a list,
and sorts the list in descending order of string length.

 Write a Python program to demonstrate the difference between shallow copy and
deep copy of lists.

You might also like