Python Questions 17 total
Python ×
0
0
answers
1What are LangChain agents and how do they differ from chains?
**LangChain Chains:**
- Fixed, predefined sequence of steps
- The flow is hardcoded by the developer
- Deterministic — same input → same...
0
0
answers
2What is a vector database and why is it used in AI applications?
A vector database stores data as high-dimensional vectors (embeddings) and enables fast similarity search.
**Why it's needed:**
LLMs unders...
0
0
answers
3How does garbage collection work in Python?
Python uses two mechanisms for memory management:
**1. Reference Counting (primary):**
Every object has a reference count. When it reaches ...
0
0
answers
4What are Python generators and when should you use them?
A generator is a function that yields values one at a time instead of returning them all at once — saving memory.
**Regular function vs G...
0
0
answers
5What is the difference between multiprocessing and multithreading in Python?
Due to Python's GIL (Global Interpreter Lock), threads can't run Python code in parallel — only one thread executes at a time.
**Multithr...
0
0
answers
6How to build a RAG chatbot with LangChain and Python?
Here is a simple RAG chatbot using LangChain:
```python
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_community....
0
0
answers
7Top 10 Python interview questions for data science jobs
Here are the most commonly asked Python questions in data science interviews:
1. Difference between list, tuple, and set
2. Explain generat...
0
0
answers
8Is Python enough to get a data science job?
Python alone is NOT enough, but it's the most important skill.
You need:
1. **Python** (Pandas, NumPy, Scikit-learn, Matplotlib)
2. **SQL**...
0
0
answers
9What is Pandas and how is it used in data science?
Pandas is a Python library for data manipulation and analysis. It provides two main data structures:
**Series** — 1D labelled array
**Dat...
0
0
answers
10What is LangChain and why is it used?
LangChain is a framework for building applications with Large Language Models (LLMs).
It provides:
- **Chains** — link multiple LLM calls...
0
0
answers
11What is the difference between == and is in Python?
**==** checks value equality — are the values the same?
**is** checks identity — are they the exact same object in memory?
```python
a ...
0
0
answers
12Explain list comprehension in Python with examples
List comprehension is a concise way to create lists.
```python
# Traditional way
squares = []
for x in range(10):
squares.append(x**2)
...
0
0
answers
13What is a Python decorator and how do you use it?
A decorator is a function that wraps another function to extend its behaviour without modifying it.
```python
def my_decorator(func):
d...
0
0
answers
14How does Python handle memory management?
Python uses automatic memory management through a private heap and a garbage collector.
1. **Reference counting** — every object tracks h...
0
0
answers
15What is the difference between a list and a tuple in Python?
Python is one of the most commonly asked Python basics interview questions.
A **list** is mutable (you can change its elements), while a **...