Instructions My six year-old daughter LOVES to read. However, she is still learning and so she can only handle words of a certain length. She
Instructions
My six year-old daughter LOVES to read. However, she is still learning and so she can only handle words of a certain length. She also loves to count, but big numbers are not her strength! Help her out!
You are going to read in a word. After you find the length of the word, you will output how long it is, unless it is "too big". If the word is more than 10 characters long, you will simply output the phrase "TOO BIG!"
Hint: You are going to need to the len() the str() functions and also make a decision! Remember (from practicum today!) that you can not concatenate a string with an integer. You must first convert the integer into a string by using the str() function.
Details
Input
The program takes in the following input:
- word: an string
Processing
-
Find the length of the string word
- Make a decision based on the length of the word and handle output based on this, as defined below.
Output
- For words of length up to 10 characters, output:
The length of the word is {Length of the word}.
- Otherwise, output:
TOO BIG!
Sample input/output:
Input | Output |
pumpkin | The length of the word is 7. |
apple | The length of the word is 6. |
lexicographical | TOO BIG! |
pie | The length of the word is 3. |
sesquipedalian | TOO BIG! |
Haligonian | The length of the word is 10. |
Haligonians | TOO BIG! |
Using python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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