Python_Interview_Questions_Tejal
Python_Interview_Questions_Tejal
3. List vs Tuple:
4. Memory Management:
print(args)
print(kwargs)
6. is vs ==:
10. Python 2 vs 3:
11. Decorators:
def deco(func):
def wrap():
print('Before')
func()
print('After')
return wrap
13. Generator:
def gen():
yield 1
yield 2
try:
1/0
except ZeroDivisionError as e:
print(e)
with open('file.txt') as f:
data = f.read()
21. GIL:
22. Metaclass:
- threading for IO-bound, multiprocessing for CPU-bound, asyncio for async IO.
26. Descriptors:
27. Caching:
@dataclass
class Point:
x: int
y: int
Python Interview Questions - Basic to Advanced
29. __slots__: