Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python program to get a string from the user, and count the number of letters (a-z or A- Z), digits (0-9), spaces,
Write a Python program to get a string from the user, and count the number of letters (a-z or A- Z), digits (0-9), spaces, and other characters. The prompt should be "Please enter a string: " The output should be formatted as "There are {:d) letters, {:d) digits, (:d) spaces, and (:d) other characters. The length of the string is (:d)." NOTE: you should strictly follow the prompt/output format to get full marks. Example1 (The contents highlighted by brown ink are inputs from the user): Please enter a string: I have a keyboard with 87 keys. There are 22 letters, 2 digits, 6 spaces, and 1 other characters. The length of the string is 30. Example2 (The contents highlighted by brown ink are inputs from the user): Please enter a string: Nothing is impossible There are 19 letters, 0 digits, 2 spaces, and 0 other characters. The length of the string is 21.
Step by Step Solution
★★★★★
3.47 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
Python Get a string from the user inputstring inputPlease en...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