Hi, I'm taking an online Python class. This is the first time I have used Python. I need Help with an assignment. For the assignment I have to Write a program that counts the number of words and the number of characters of each word in a sentence entered by the user. I can get the input and the word count correct. I need help figuring how to count each individual character in each individual word. The part I need help with the most is the character count variable and loop. I appreciate anyone who helps with this. I'm using Python 3.4.3.
Sentence word and Character counter.py
count the number of words and the number of characters of each word in
a sentence entered by the user
def main():
get the user to enter a sentence
UserInput = input("Please enter your sentcence.")
Words = UserInput.split()
WordCount = len(Words[0])
CharacterCount = len(Words[1])
loop
for Words in UserInput.split():
WordCount = len(Words[0])
CharacterCount = len(Words[1])
print("The wordcount is:" , WordCount)
print("The Charactercount is:" , CharacterCount)
main()