Skip to content

manavm1990/python-playground

Repository files navigation

Fixin' To Lurning Me Some Python 🐍

Uses:

  • Poetry for package management.
  • Ruff for code quality.
  • Pytest for......:✅
  • MyPy for types 🏷️.

Lurning Challenges

These can be found in utils.py.

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

Releases

No releases published

Packages

No packages published

Languages