71.3k views
2 votes
Write a program that prints out the letters of a word, each followed by a dot?

User David Kean
by
8.8k points

1 Answer

3 votes

Final answer:

A program can be written to print each letter of a user-provided word followed by a dot using a simple for loop. The user inputs a word, and for each letter in the word, the program prints the letter followed by a dot on the same line.

Step-by-step explanation:

To print out the letters of a word each followed by a dot, you can write a simple program in a language like Python. Below is a step-by-step explanation of such a program.

  1. First, you would take a word as input from the user.
  2. Then, you would create a loop that goes through each letter of the word.
  3. In each iteration of the loop, you would print the current letter followed by a dot.

Here is a sample Python program that accomplishes this task:

word = input('Enter a word: ')

for letter in word:
print(letter + '.', end=' ')

When you run this program, it will ask for a word and then output each letter of the word followed by a dot without adding a newline between each letter.

User Matt Mc
by
8.4k points