114k views
2 votes
Write a program that prints out the letters of a word on a single line, separated by two underscores?

1 Answer

6 votes

Final answer:

To write a program that prints out the letters of a word on a single line, separated by two underscores, you can use a loop to iterate through each letter of the word.

Step-by-step explanation:

To write a program that prints out the letters of a word on a single line, separated by two underscores, you can use a loop to iterate through each letter of the word. Here is an example program in Python:

word = input('Enter a word: ') # get input from the user

for letter in word:
print(letter, end='__') # print each letter followed by two underscores

For example, if the user enters the word 'hello', the output will be 'h__e__l__l__o__'.

User Zhuoyun Wei
by
7.9k points