Which of the following statements is FALSE about traversing a string using loops in Python? 

a. We can use a for loop with the in operator to iterate over each character in a string.

b. We can use a while loop with the len() function and indexing to access each character in a string. 

c. We can use slicing with a negative step to iterate over the characters in a string in reverse order. 

d. We can use the range() function with the len() function to generate the indices of the characters in a string.

Answer:

Answer by student

c. We can use slicing with a negative step to iterate over the characters in a string in reverse order.

Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo