Python_Practice_Questions_Updated
Python_Practice_Questions_Updated
File Handling
- Write a Python program that appends data to an existing file.
- Create a function to count the number of words in a text file.
- Write a Python program to copy content from one file to another.
- Develop a function that reads a CSV file and prints each row as a dictionary.
Exception Handling
- Write a program that takes a list of numbers and calculates their average. Handle cases where the
list is empty.
- Write a Python program to safely perform division and handle any exceptions.
- Define a function that opens a file and prints its contents, with exception handling for file not found.
- Create a function that safely converts a list of strings to integers and handles conversion errors.
Basics of Sorting Algorithms
- Implement the Insertion Sort algorithm to sort a list of numbers.
- Write a function that performs Merge Sort on a given list.
- Develop a Python program to sort a list of dictionaries by a specific key.
- Create a function to perform Quick Sort on a list of integers.
Case Studies
- Baker's Problem: Write a function to calculate ingredient quantities based on batch size.
- Caesar Cipher: Create a decryption function for Caesar cipher.
- Substitution Cipher: Implement a simple substitution cipher with a given key.
- Baker's Problem: Develop a function to estimate baking time based on available ovens.