Uses:
- Function Exercises:
Write a function that takes a list of strings and returns a new list with all strings converted to uppercase.Implement a function that takes a list of numbers and returns the second largest number in the list.Create a function that checks if a given string is a palindrome (reads the same forwards and backwards).
- File Handling:
Write a script that reads a text file and counts the frequency of each word in the file.Implement a function that takes a directory path and a file extension, and returns a list of all files in the directory with that extension.Create a script that reads a CSV file and converts it into a JSON file.
- Object-Oriented Programming (OOP):
Define a Rectangle class with attributes for length and width, and methods to calculate the area and perimeter.Create a BankAccount class with methods for deposit, withdrawal, and balance inquiry.Implement an Employee class with attributes for name, ID, and salary, and methods to calculate the annual salary and apply a raise.
- Decorators:
Write a decorator that measures the execution time of a function and prints it.Implement a decorator that caches the result of a function for a given set of arguments to improve performance.Create a decorator that logs the input and output of a function.
- Generators and Iterators:
Modify thesum_even_numbers
function to use a generator expression instead of a list comprehension.Implement a generator function that yields Fibonacci numbers up to a given limit.Create an iterator class that iterates over the lines of a file.
- Networking:
Write a script that retrieves the HTML content of a given URL using the requests library.Implement a simple client-server communication using sockets.Create a simple RESTful API usinghttp.server
.