233k views
0 votes
write a program that reads a character, then reads in a list of words. the output of the program is every word in the list that contains the character at least once. assume at least one word in the list will contain the given character. ex: if the input is:

1 Answer

1 vote

Final answer:

The program prompts for a character and a list of words, splits the list into individual words, and iterates through, printing each word containing the character.

Step-by-step explanation:

To write a program that reads a character and then reads in a list of words, outputting every word that contains the character at least once, we can use any programming language like Python, Java, or C++. For simplicity, here's an example in Python:

character = input('Enter a character: ')
words = input('Enter list of words: ').split()

for word in words:
if character in word:
print(word)

This program starts by asking the user to enter a character and a list of words. The list of words is then split into individual words. It goes through each word in the list and prints the ones that contain the specified character.

User Eumel
by
7.8k points