DSSSB TGT CS Mock 02 – Question 185

Question:

In Python, which built-in function returns an iterator of tuples containing the index and corresponding element from an iterable?

पायथन में, कौन-सा अंतर्निहित फ़ंक्शन किसी इटरेबल से इंडेक्स और संबंधित तत्व वाले टुपल्स का इटरेटर लौटाता है?

Options:

  • enumerate()
  • zip()
  • map()
  • range()
  • enumerate()
  • zip()
  • map()
  • range()

Correct Answer: a)

Explanation:

The `enumerate(iterable, start=0)` function adds a counter/index to an iterable and returns it as an enumerate iterator of `(index, value)` pairs (Option a).

पायथन में इंडेक्स और मान दोनों को एक साथ प्राप्त करने के लिए enumerate() का उपयोग किया जाता है (विकल्प a)।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top