# Define a string variable x with the value "Test5"
x = "Test5"
# Use a for loop to iterate over each character in the string x
for i in x:
# Print "Hello World" for each character
print("Hello World")
Explanation:
x = "Test5": Initializes a variablexwith the string value "Test5".for i in x:: This line starts aforloop that iterates over each character in the stringx. In each iteration, the current character is assigned to the variablei.print("Hello World"): Inside the loop, this line prints the string "Hello World" for each character in the stringx. Since the loop is iterating over the characters of "Test5", the "Hello World" message will be printed five times, once for each character.
Output:
Hello World
Hello World
Hello World
Hello World
Hello World

0 Comments