def text_analyzer(text):
# Convert the input text to lowercase for case-insensitive analysis
text = text.lower()
# Count the total number of characters, including spaces and numbers
total_characters = len(text)
# Count the total number of vowels (a, e, i, o, u)
vowels = "aeiou"
total_vowels = sum(1 for char in text if char in vowels)
# Split the text into words and calculate the average word length
words = text.split()
total_words = len(words)
total_word_length = sum(len(word) for word in words)
if total_words > 0:
average_word_length = total_word_length / total_words
else:
average_word_length = 0
# Display the results
print("Text Analysis Results:")
print(f"Total # of characters (including spaces + numbers): {total_characters}")
print(f"Total vowels: {total_vowels}")
print(f"Average word length: {average_word_length:.2f}")
# Accept user input
user_input = input("Enter a text for analysis: ")
# Call the text_analyzer function with the user's input
text_analyzer(user_input)
Text Analysis Results:
Total # of characters (including spaces + numbers): 1
Total vowels: 0
Average word length: 1.00