Occurs when index out of range Occurs when wrong data type used
Example: a[10] Example: "hi" + 5
---
14. Python code to create a dictionary using dict().
d = dict(name="Ram", age=20,)
---
15. Distinguish between pop() and popitem().
pop() popitem()
Removes element by key Removes last inserted item
d.pop('key') d.popitem()
---
16. Differentiate mutable and immutable.
Mutable Immutable
Can be changed Cannot be changed
Example: list Example: string
---
17. Define tuple packing.
Tuple packing means storing multiple values into a single tuple.
t = 10, 20, 30
---
18. Python code to refer the last item of a tuple.
t = (1,2,3,4)
print(t[-1])
---
19. List the characteristics of set.
Unordered
No duplicate elements
Mutable
Allows set operations (union, intersection)
---
20. Differentiate discard() and remove() in set.
discard() remove()
Does NOT raise error if item missing Raises error if item missing
---
21. List the features of DataFrame.
2D labeled data structure
Columns can be of different types
Supports indexing and slicing
Fast operations using NumPy
Easier to handle tabular data
---
22. Explain constructor to create a pandas DataFrame.
import pandas as pd
df = pd.DataFrame(data)
---
23. Expansion for PANDAS and NUMPY.
PANDAS → Python Data Analysis Library
NUMPY → Numerical Python
---
24. List the uses of NumPy.
Creating arrays
Fast mathematical calculations
Matrix operations
Data analysis
Broadcasting operations
---
------------------------------------------
📌 PART – B (6 MARKS EACH)
------------------------------------------
---
1. Demonstrate if-elif ladder with program. (6 marks)
✅ MODULE Il
Mulai dari awal
