Write a Python program that prompts the user to enter a sequence of lowercase words and stores in a list only those words whose first letter occurs again elsewhere in the word (e.g., "baboon"). Continue entering words until the user enters an empty string ("", not " "), at which point your program should print the list. You may want to create a helper function (a function that accomplishes some smaller part of your main task) that takes in a single string, and returns True if the first letter is repeated, or False otherwise. You could use a loop to do this, but you may also want to consider just using slicing and the in keyword, or the .count method.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question
Please answer quickly In python
Write a Python program that prompts the user to enter a sequence of lowercase words and stores in a list
only those words whose first letter occurs again elsewhere in the word (e.g., "baboon"). Continue
entering words until the user enters an empty string ("", not " "), at which point your program should
print the list.
You may want to create a helper function (a function that accomplishes some smaller part of your main
task) that takes in a single string, and returns True if the first letter is repeated, or False otherwise.
You could use a loop to do this, but you may also want to consider just using slicing and the in keyword,
or the .count method.
Be sure to use an appropriate while condition here: while(True) might work in this case but it's bad style.
Example:
Enter a word: im
Enter a word: a
Enter a word: member
Enter a word: of
Enter a word: the
Enter a word: imperial
Enter a word: senate
Enter a word: on
Enter a word: a
Enter a word: diplomatic
Enter a word: mission
Enter a word: to
Enter a word: alderaan
Enter a word:
['member', 'imperial', 'alderaan']
Transcribed Image Text:Write a Python program that prompts the user to enter a sequence of lowercase words and stores in a list only those words whose first letter occurs again elsewhere in the word (e.g., "baboon"). Continue entering words until the user enters an empty string ("", not " "), at which point your program should print the list. You may want to create a helper function (a function that accomplishes some smaller part of your main task) that takes in a single string, and returns True if the first letter is repeated, or False otherwise. You could use a loop to do this, but you may also want to consider just using slicing and the in keyword, or the .count method. Be sure to use an appropriate while condition here: while(True) might work in this case but it's bad style. Example: Enter a word: im Enter a word: a Enter a word: member Enter a word: of Enter a word: the Enter a word: imperial Enter a word: senate Enter a word: on Enter a word: a Enter a word: diplomatic Enter a word: mission Enter a word: to Enter a word: alderaan Enter a word: ['member', 'imperial', 'alderaan']
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr