KnowledgeBoat Logo
|

Computer Science

How many times is the word 'HELLO' printed in the following statement?

s = "python rocks"
for ch in s:
    print ("Hello")

Python String Manipulation

2 Likes

Answer

The word 'Hello' is printed 12 times in the given Python code because the string s = "python rocks" contains 12 characters. The for loop iterates through each character in the string, printing 'Hello' once for each character, resulting in a total of 12 prints.

Answered By

2 Likes


Related Questions