This repository contains solutions for various Python assessment projects and miscellaneous questions related to Python programming. The repository is organized into folders for each microservice and a separate folder for general answers.
- To indicate and propagate errors: use try/except or return an error value?
- Explain the difference between mutable and immutable types
- Define lambda, iterator, generator; and give examples how to use them
- What do you use for testing? Linting? Debugging? Type enforcement?
Create a simple user registry microservice using FastAPI. The service should:
- Provide endpoints to create, read, update, and delete user profiles.
- Each user profile should contain fields like id, name, email, and age.
- Store the user profiles in a SQLite or PostgreSQL database.
Create a simple caching microservice using FastAPI. The service should:
- Provide endpoints to create and read generated payloads files. The create endpoint returns an identifier of the generated payload, and the read endpoint returns the actual payload.
- Payloads files are generated as follows:
- The input is two lists of strings (of same length)
- The strings are transformed by a “transformer function” (simulate external service)
- The output is the interleaving of the transformed strings from the two lists
- The service should cache the outcome of the “transformer function” for use in future requests
- Reuse cached outcomes instead of calling the “transformer function” if possible
- Reuse payload identifier for generated payloads already generated before
- Store the cached outcome results in a SQLite or PostgreSQL database.
- Use FastAPI to create the API endpoints.
- Use SQLModel or SQLAlchemy for database interactions.
- Dockerize the application for deployment.