In: Computer Science
Write a Python program that prompts the user to enter a list of words and stores in a list only those words whose first letter occurs again within the word (for example, 'Baboon'). The program should display the resulting list..................please explain step by step
PYTHON Program:
req_list =[]
i=0
n = int(input("Enter the number of words to be entered: "))
while i<n:
input_string = input("Enter the word: ")
lowercase_input_string = input_string.lower()
input_first_letter = lowercase_input_string[0]
rem_string = lowercase_input_string[1:]
res = rem_string.find(input_first_letter)
if res!= -1:
req_list.append(input_string)
i += 1
print("Words whose first letter repeats are:")
print(req_list)
Output: