Question: . Consider the following code: 1 # Read in words from the user, and 'clean' it for later use 2 noun = input (
Consider the following code:
# Read in words from the user, and 'clean' it for later use
noun inputPlease enter a nonproper noun:
noun noun.lower # Make lowercase
noun noun.strip # Get rid of extra whitespace
adj inputPlease enter an adjective:"
adj adj.lower # Make lowercase
adj adj.strip # Get rid of extra whitespace
verb inputPlease enter a verb:"
verb verb.lower # Make lowercase
verb verb.strip # Get rid of extra whitespace
adv inputPlease enter an adverb:"
adv adv.lower # Make lowercase
adv adv.strip # Get rid of extra whitespace
printf "The noun was a very adj noun It always adv verb everywhere."
a As we can see, it is very repetitive. What is a function you could write to simplify the
code?
how can i do this using loops
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
