161k views
11 votes
Prompt the user for a word and then print out the string length formatted like the following input.

Enter word: example
Length: 7
Note: While it can be frustrating, coding to a specification requires that the output match exactly what is requested. If you have an error make sure it contains the correct spacing and newlines when needed.

Python

1 Answer

5 votes

Answer:

In Python:

word = input("Enter word: ")

print("Length: "+str(len(word)))

Step-by-step explanation:

This prompts the user for word

word = input("Enter word: ")

This calculates and prints the length of the input word

print("Length: "+str(len(word)))

The length of the word is calculated using the len keyword

User Nikhil Padmanabhan
by
5.1k points