Question

Instructions My six year-old daughter LOVES to read. However, she is still learning and so 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

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question.


Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, 


Please rate the answer. Thanks!


===========================================================================

word = input('Enter a string: ') # prompt user to enter the word
word_length = str(len(word)) # find the length using len() function and then convert it to string

# check the length is less than equal to 10 
if len(word)<=10: # if true print the message
    print('The length of the word is {}.'.format(word_length))
else:
    print('TOO BIG!') # the word length is more than 10 so print too big

=========================================================

Add a comment
Know the answer?
Add Answer to:
Instructions My six year-old daughter LOVES to read. However, she is still learning and so she...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • TASK Your task is to build a palindrome from an input string. A palindrome is a...

    TASK Your task is to build a palindrome from an input string. A palindrome is a word that reads the same backward or forward. Your code will take the first 5 characters of the user input, and create a 9- character palindrome from it. Words shorter than 5 characters will result in a runtime error when you run your code. This is acceptable for this exercise – we will cover input validation in a later class. Some examples of input...

  • Problem #1 Create a program that performs the following functions: Uses character arrays to read a...

    Problem #1 Create a program that performs the following functions: Uses character arrays to read a user's name from standard input Tells the user how many characters are in her name Displays the user's name in uppercase Create a program that uses the strstr() function to search the string "When the going gets tough, the tough stay put! for the following occurrences (display each occurrence found to standard output): "Going" "tou" "ay put!" Build a program that uses an array...

  • Recursion and Trees Application – Building a Word Index Make sure you have read and understood...

    Recursion and Trees Application – Building a Word Index Make sure you have read and understood ·         lesson modules week 10 and 11 ·         chapters 9 and 10 of our text ·         module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...

  • This looks long but it is easy just having some trouble please help out thank you....

    This looks long but it is easy just having some trouble please help out thank you. Find and fix all syntax and semantic errors which prevent the program from compiling. Find and fix all logical errors which cause the program to crash and/or produce unexpected results. In addition to making sure the code compiles, we have one final method which we need to complete. There is a method in the code, printAll, which is responsible for printing out the entirety...

  • 1. You are given a C file which contains a partially completed program. Follow the instructions...

    1. You are given a C file which contains a partially completed program. Follow the instructions contained in comments and complete the required functions. You will be rewriting four functions from HW03 (initializeStrings, printStrings, encryptStrings, decryptStrings) using only pointer operations instead of using array operations. In addition to this, you will be writing two new functions (printReversedString, isValidPassword). You should not be using any array operations in any of functions for this assignment. You may use only the strlen() function...

  • 1 Objective Build a hashing algorithm that is suitable for use in a Bloom Filter. Please...

    1 Objective Build a hashing algorithm that is suitable for use in a Bloom Filter. Please note that while a cryptographic hash is quite common in many Bloom Filters, the hashing algorithm to be implemented is a mix of the the following algorithmic models, specifically, a multiply & rotate hash colloquially known as a murmur hash, and an AND, rolale, & XOR hash colloquially known as an ARX hash. 2 Requirements • Inputs. Read the input file which contains strings...

  • Hey guys I need help with this assignment. However it contains 7 sub-problems to solve but I figured only 4 of them can...

    Hey guys I need help with this assignment. However it contains 7 sub-problems to solve but I figured only 4 of them can be solved in one post so I posted the other on another question so please check them out as well :) Here is the questions in this assignment: Note: Two helper functions Some of the testing codes for the functions in this assignment makes use of the print_dict in_key_order (a dict) function which prints dictionary keyvalue pairs...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops....

    Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops. Instructions This assignment will be different than previous assignments (and most assignments which come after it). In this assignment, you will be crafting four solutions to four different problems. This assignment will also have special requirements regarding how you may code. You are not allowed to use assignment statements. This includes using preincement, postincrement, predecrement, and postdecrement. You are allowed to use assignment to...

  • !!!!!!!Java!!!!! When you are confident that your methods work properly and that you can generate random...

    !!!!!!!Java!!!!! When you are confident that your methods work properly and that you can generate random text with my generateText method, you can move on to the second step. Create a third class called Generator within the cs1410 package. Make class. This class should have a main method that provides a user interface for random text generation. Your interface should work as follows: Main should bring up an input dialog with which the user can enter the desired analysis level...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT