Ravindra BagaleCourses & study guides

3. Python Basics for Data Work

3.4 Comprehensions (Short Form)

amounts = [64, 90, 240, 58, 1299]
big = [a for a in amounts if a >= 200]
print(big)  # [240, 1299]

labels = {c: c[:3].upper() for c in ["Pune", "Nagpur", "Kolhapur"]}
print(labels)

You will prefer pandas filters soon; comprehensions still help for small Python-side lists.

Thodkyaat sangaycha tar (quick recap)

  • Know str / int / float / bool and f-strings
  • list + dict for small structures; .get for safe keys
  • Functions keep fee logic reusable
  • Comprehensions = compact loops

Samajla ka? Aata pudhe jaauya NumPy essentials.