Skip to main content
Home › Blog › #python
Tag

#python

155 articles
How do Python dictionaries work internally and what is their time complexity?

Python dictionaries are hash tables. Lookup insertion and deletion are O(1) average case. Hash collisions can degrade this to O(n) worst case but Python’s implementation makes this extremely rare. Python…

🏷️
Can you explain how to use Python’s subprocess module to run shell commands from a Python script?

The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. You can use subprocess.run to execute a command and wait for…

🏷️
What is a metaclass in Python and when would you actually use one?

A metaclass is the class of a class — it controls how classes themselves are created. Use them when you need to enforce constraints auto-register classes or modify class definitions…

🏷️
How would you design a scalable database architecture for a Flask application that handles large volumes of transactions, and what considerations would you take into account for data consistency and performance?

I would design a microservices architecture with separate databases for different services, using a distributed database system like PostgreSQL or MongoDB. Data consistency can be managed using event sourcing and…

🏷️
What is the purpose of ‘self’ in Python class methods?

‘self’ refers to the specific instance of the class that a method is being called on. It gives each instance access to its own attributes and other methods.

🏷️
Can you explain how FastAPI handles request validation and why it’s important?

FastAPI uses Pydantic models for request validation, which allows you to define expected data structures easily. It’s important because it ensures that your APIs only accept valid data, reducing errors…

🏷️
What are some common security practices you should follow when developing a Django application?

Common security practices in Django include using Django’s built-in authentication and permission systems, validating and sanitizing user input, and ensuring CSRF protection is enabled. Additionally, using HTTPS for all communications…

🏷️
How would you handle merging large datasets in Pandas while ensuring performance and avoiding memory issues?

To efficiently merge large datasets in Pandas, I would use the ‘merge’ function with appropriate parameters for ‘how’ and ‘on’ to minimize the dataset size being processed. Additionally, I would…

🏷️
How do you approach designing a Python application that requires high scalability and maintainability, particularly in terms of architecture and team collaboration?

I focus on modular design, using microservices or service-oriented architecture to ensure each component can scale independently. I also emphasize robust API design and clear documentation to facilitate team collaboration…

🏷️
What are *args and **kwargs in Python functions?

*args collects extra positional arguments as a tuple. **kwargs collects extra keyword arguments as a dictionary. Both allow functions to accept a variable number of arguments.

🏷️
Can you explain how to effectively use Matplotlib and Seaborn to visualize a dataset that contains missing values?

To visualize datasets with missing values in Matplotlib and Seaborn, I first clean the data by either filling in or dropping the missing values. Seaborn’s ‘dropna()’ method is helpful to…

🏷️
Can you explain how to implement a simple linear regression model using Python libraries like NumPy or scikit-learn?

You can implement linear regression in Python using scikit-learn by first importing the LinearRegression class, then fitting it with your input features and target variable. After training, you can use…

🏷️
1 … 4 5 6 7 8 … 13
2,000 Interview Questions and Answers PDF cover
Developer Interview Kit · PDF

2,000 Interview Questions & Answers, in one PDF

  • Short answers, in-depth explanations, common mistakes and follow-ups
  • 89 topics, from Beginner to Architect, with a clickable contents list
  • 226 extra questions that are not on this website
  • Free Bonus Pack: 30-day study plan, behavioral questions, salary scripts
$7.99 one-time · instant email delivery
260 Developer Learning Paths cover
Also available: 260 Developer Learning Paths $4.99 Week-by-week roadmaps for 16 career tracks (Python, React, Java, DevOps, SQL, AI and more), with a progress tracker on every path. See what's inside →

Get both books for $9.99 (save $2.99):

The material stays free to read online. This is the organised, offline, print-ready PDF edition. Secure payment by PayPal; your personal download link is emailed after payment is confirmed. Digital product, no shipping.