Word Lengths

Write a program that accepts three words from the user. The length of each word should be added to a total. Each word and its length should then be displayed to the user as well as the total length of the combined words.

Enter the first word: Studying
Enter the second word: is
Enter the third word: awesome
Studying has 8 characters.
is has 2 characters.
awesome has 7 characters.
Total characters: 17
DECLARE word1, word2, word3 AS STRING
DECLARE total AS INTEGER

OUTPUT "Enter the first word: "
INPUT word1
OUTPUT "Enter the second word: "
INPUT word2
OUTPUT "Enter the third word: "
INPUT word3

SET total TO LENGTH(word1) + LENGTH(word2) + LENGTH(word3)

OUTPUT word1, " has ", LENGTH(word1), " characters."
OUTPUT word2, " has ", LENGTH(word2), " characters."
OUTPUT word3, " has ", LENGTH(word3), " characters."
OUTPUT "Total characters: ", total

word1 = str(input("Enter the first word: "))
word2 = str(input("Enter the second word: "))
word3 = str(input("Enter the third word: "))

total = len(word1) + len(word2) + len(word3)

print(word1, "has", len(word1), "characters.")
print(word2, "has", len(word2), "characters.")
print(word3, "has", len(word3), "characters.")
print("Total characters:", total)
# Get each word and store as its own variable
word1 = str(input("Enter the first word: "))
word2 = str(input("Enter the second word: "))
word3 = str(input("Enter the third word: "))

# Calculate the total characters
total = len(word1) + len(word2) + len(word3)

# Print each word and its character count
print(word1, "has", len(word1), "characters.")
print(word2, "has", len(word2), "characters.")
print(word3, "has", len(word3), "characters.")

# Print the total characters
print("Total characters:", total)

Extension

Extend the program to calculate the average character length of the words rounded to 1 decimal place.

Enter the first word: Studying
Enter the second word: is
Enter the third word: awesome
Studying has 8 characters.
is has 2 characters.
awesome has 7 characters.
Total characters: 17
Average characters per word: 5.7

Target

You should be able to use the Length predefined function to solve a problem.