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

100 python

mm

Uploaded by

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

100 python

mm

Uploaded by

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

Basic Problems

Write a Python function to calculate the factorial of a number.


Write a function to check if a given number is prime.
Write a Python function to reverse a string.
Write a function to check if a string is an anagram of another string.
Write a Python function to find the largest element in a list.
Write a function to compute the nth Fibonacci number.
Write a function to check if a string is a palindrome.
Write a Python function to compute the sum of digits in a number.
Write a function to find the second largest number in a list.
Write a function to count the number of vowels in a string.
List and String Problems
Write a Python function to find the intersection of two lists.
Write a function to remove duplicates from a list.
Write a function to check if all elements in a list are unique.
Write a Python function to find the longest common prefix in a list of strings.
Write a function to rotate an array by k positions to the right.
Write a function to sort a list of strings based on the length of each string.
Write a Python function to merge two sorted lists into a single sorted list.
Write a function to find the missing number in a list of integers from 1 to n.
Write a function to find the kth smallest element in an unsorted list.
Write a Python function to find all anagrams of a word from a list of words.
Dictionary and Set Problems
Write a function to count the frequency of each character in a string and store it
in a dictionary.
Write a function to find the most frequent element in a list.
Write a Python function to merge two dictionaries.
Write a function to find the intersection of two dictionaries.
Write a function to check if two strings are anagrams using dictionaries.
Write a Python function to remove duplicate characters from a string and return the
unique characters in the same order.
Write a function to find the union of two sets.
Write a Python function to check if a given set is a subset of another set.
Write a function to find the symmetric difference between two sets.
Write a Python function to count the number of occurrences of each word in a given
sentence.
File Handling and Input/Output Problems
Write a function to read a text file and count the number of words.
Write a Python function to copy the contents of one file to another.
Write a function to find the longest line in a text file.
Write a function to append data to a file.
Write a Python function to read and parse a CSV file.
Write a function to serialize and deserialize a Python object to/from a file.
Write a function to read a JSON file and convert it to a Python dictionary.
Write a Python function to format a datetime object as a string.
Write a function to read a binary file and display its contents in hexadecimal
format.
Write a Python function to read a YAML file and convert it to a Python dictionary.
Advanced Data Structures Problems
Write a function to implement a stack using a list.
Write a Python function to implement a queue using two stacks.
Write a function to implement a doubly linked list.
Write a Python function to implement a binary search tree (insertion, deletion,
search).
Write a function to implement a heap (insertion, deletion, heapify).
Write a Python function to implement a trie data structure.
Write a function to implement a LRU (Least Recently Used) cache using dictionaries
and lists.
Write a Python function to implement a circular queue using arrays.
Write a function to implement a priority queue using heaps.
Write a function to implement an adjacency matrix representation of a graph.
Algorithmic Problems
Write a Python function to implement bubble sort.
Write a function to implement selection sort.
Write a Python function to implement insertion sort.
Write a function to implement merge sort.
Write a Python function to implement quick sort.
Write a function to implement binary search on a sorted list.
Write a Python function to implement Dijkstra's algorithm.
Write a function to implement breadth-first search (BFS) on a graph.
Write a Python function to implement depth-first search (DFS) on a graph.
Write a function to implement the Sieve of Eratosthenes to find all prime numbers
up to a given limit.
Object-Oriented Programming Problems
Write a Python class Rectangle with attributes length and width, and methods to
calculate its area and perimeter.
Write a class Circle that inherits from Shape with attributes radius and methods to
calculate its area and circumference.
Write a Python class Student with attributes name, roll_number, and marks, and
methods to display student information.
Write a class Stack to implement a stack data structure with methods push, pop, and
peek.
Write a Python class Queue to implement a queue data structure with methods
enqueue, dequeue, and peek.
Write a class LinkedList to implement a singly linked list with methods to insert,
delete, and search for elements.
Write a Python class BinarySearchTree to implement a binary search tree with
methods to insert, delete, and search for nodes.
Write a class ComplexNumber with methods to add, subtract, multiply, and divide
complex numbers.
Write a Python class Matrix with methods to add, subtract, and multiply matrices.
Write a class Graph to implement an adjacency list representation with methods to
add vertices, edges, and perform BFS/DFS.
Miscellaneous Problems
Write a Python function to generate all permutations of a list.
Write a function to find the longest substring without repeating characters in a
given string.
Write a Python function to generate Pascal's triangle up to n rows.
Write a function to convert a Roman numeral to an integer.
Write a Python function to find the maximum profit by buying and selling stocks
from a list of prices.
Write a function to calculate the edit distance between two strings.
Write a Python function to find the median of two sorted arrays.
Write a function to generate the nth row of Pascal's triangle.
Write a Python function to implement the Game of Life simulation.
Write a function to find all possible combinations of k numbers from a list of n
numbers.
Python Libraries Problems
Write a function to use requests library to fetch data from a REST API and display
it.
Write a Python script to use matplotlib to plot a line graph of temperature data
over time.
Write a function to use numpy to perform matrix multiplication of two arrays.
Write a Python function to use pandas to read a CSV file and perform data analysis
(e.g., calculate mean, median).
Write a function to use scikit-learn to train and test a machine learning model
(e.g., linear regression, classification).
Write a Python function to use BeautifulSoup to scrape data from a website.
Write a function to use sqlite3 to create a database, insert data, and perform
queries.
Write a Python script to use tkinter to create a GUI application with buttons and
input fields.
Write a function to use os module to list all files in a directory and its
subdirectories.
Write a Python script to use pytest to write and run unit tests for a function or
module.
Problem Solving and Optimization Problems
Write a Python function to find the longest increasing subsequence of a list of
integers.
Write a function to find the minimum number of coins needed to make change for a
given amount.
Write a Python function to solve the knapsack problem using dynamic programming.
Write a function to find the maximum sum subarray using Kadane's algorithm.
Write a Python function to solve the Tower of Hanoi problem recursively.
Write a function to find the shortest path in a maze using BFS.
Write a Python function to solve the traveling salesman problem using a brute force
approach.
Write a function to find all subsets of a set (powerset).
Write a Python function to find the longest palindromic substring in a given
string.
Write a function to generate all valid parentheses combinations for a given number
n.

You might also like