1. Home
  2. Data Science
  3. Python
  4. What does the send() method of a generator do in Python?

Added 25 Nov 2026

What does the send() method of a generator do in Python?

  1. Sends a value into the generator at the yield expression Correct answer
  2. Sends data over a socket
  3. Closes the generator
  4. Resets the generator

Correct answer

A. Sends a value into the generator at the yield expression

5 views

MCQSEXAM

Explanation

send resumes the generator and the sent value becomes the result of yield.

Reference

Asked in: Python Interview Advanced

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs