1. Home
  2. Data Science
  3. Python
  4. What is the key feature of the 'for' loop in Python?

Added 10 Feb 2024

What is the key feature of the 'for' loop in Python?

  1. It requires a condition to terminate
  2. It is used exclusively for numerical iterations
  3. It iterates over a sequence of elements Correct answer
  4. It can only be nested within a 'while' loop

Correct answer

C. It iterates over a sequence of elements

15 views

MCQSEXAM

Explanation

The 'for' loop in Python is used to iterate over a sequence of elements such as lists, tuples, strings, or ranges. It iterates through each item in the sequence and executes the block of code for each item.

Reference

https://www.w3schools.com/python/python_conditions.asp

Doubts & discussion

Not sure why the answer is C? 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