Final answer:
To achieve this, you can use a while loop that continues until the user enters 'no', regardless of the case variation. Inside the loop, you can prompt the user to enter a word and then capitalize it using the capitalize() method in Python. After capitalizing the word, you can print it along with its length using the len() function.
Step-by-step explanation:
To achieve this, you can use a while loop that continues until the user enters 'no', regardless of the case variation. Inside the loop, you can prompt the user to enter a word and then capitalize it using the capitalize() method in Python. After capitalizing the word, you can print it along with its length using the len() function.
word = input('Enter a word: ')
while word.lower() != 'no':
capitalized_word = word.capitalize()
print(capitalized_word, ' - Length:', len(capitalized_word))
word = input('Enter a word: ')
For example, if the user enters 'hello', the program will output 'Hello - Length: 5'. The loop will continue until the user enters 'no', regardless of whether it is in uppercase, lowercase, or a combination of both.