Q. Which keyword is used to define a generator in Python?

  • (A) def
  • (B) gen
  • (C) yield
  • (D) return
πŸ’¬ Discuss
βœ… Correct Answer: (C) yield
Explanation: `yield` is used to define a generator and return a value from it.
Explanation by: Mr. Dubey
`yield` is used to define a generator and return a value from it.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
80
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
94%
Success Rate