The for loop in Python is used to ___ over a sequence or other iterable objects

42. The for loop in Python is used to ___ over a sequence or other iterable objects.

  1. Jump
  2. Iterate
  3. Switch
  4. All of the mentioned above

Answer: B) Iterate

Explanation:

It is possible to iterate over a sequence or other iterable objects using the for loop in Python. The process of iterating over a sequence is referred to as traversal. Following syntax can be follow to use for loop in Python Program

for val in sequence:
    ...
    loop body
    ...

For loop does not require an indexing variable to set beforehand.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.