Python Programming - Loops - Discussion
Discussion Forum : Loops - General Questions (Q.No. 26)
26.
Which loop is used for iterating over the characters of a string?
Answer: Option
Explanation:
The
for
loop is commonly used for iterating over the characters of a string in Python.
my_string = "Hello"
for char in my_string:
print(char)
In this example, the for
loop iterates over each character in the string my_string
and prints it to the console.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers