generate functionThu, 02 Mar 2023

Enter a list of student names in one line separated by a space. Determine that at least one name in this list starts and ends with the same letter (case insensitive). Implement the program using a while loop and a break statement. Print YES if the condition is met and NO otherwise.

text = input() t = text.split() for i in range(len(t)): if t[i][0].upper() == t[i][-1].upper(): print("YES") break if i == len(t) - 1: print("NO")

Questions about programming?Chat with your personal AI assistant