202k views
4 votes
Write a program that reads a word and uses a for loop to print each character of the word on a separate line?

User Sascuash
by
8.0k points

1 Answer

2 votes

Final answer:

To write a program that reads a word and prints each character on a separate line using a for loop, use a for loop to iterate over each character in the word and print them on separate lines.

Step-by-step explanation:

To write a program that reads a word and prints each character on a separate line using a for loop, you can use the following code in Python:

word = input("Enter a word:")
for char in word:
print(char)

This program prompts the user to enter a word and then iterates over each character in the word using a for loop. It prints each character on a separate line.

User Seancarlos
by
8.5k points