Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to write python code to help me give word count digit count etc. this is what i have but digit count and sentence
I need to write python code to help me give word count digit count etc. this is what i have but digit count and sentence count is not working. Must use boolean in if statements
char = input("Please enter text to analyze(press ENTER/return without text to exit): ") count = 0 num_digits = 0 num_letters = 0 num_sentences = 0 num_spaces = 0 length len(char) for char in char: if character is letter (char)== True: num_letters = num_letters+1 elif characterais whitespace cchardman True: num_spaces = num_spaces+ 1 elif characteraends sentence(char ==True: num_sentences = num_sentences +1 elif character is digitaTrue: num_digits num_digits+ 1 count = num_digits+num_sentences+num_spaces+num_letters print() print("Count of characters: + str(count))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started