a) Write a function that takes a string as its argument
If the word is 4 characters or shorter, return the argument inUPPERCASE. If the word is 4 letters or longer, return the word inlowercase.
process_word(“The”) # returns ‘THE’
process_word(“Answer”) # returns ‘answer’
# hint .upper(), .lower()
b) Write a second function that takes a string of a sentence,splits it into multiple words, applies the first function to eachword, and then returns a new string of the processed sentence.
sentence = “Four score and seven years ago our fathers broughtforth, on this continent, a new nation, conceived in Liberty, anddedicated to the proposition that all men are created equal.”
# would print:
# FOUR score AND seven years AGO OUR fathers brought forth, ON THIScontinent, A NEW nation, conceived IN liberty, AND dedicated TO THEproposition THAT ALL MEN ARE created equal.
# hint: .split(), map(function, list), ” “.join(list)
Now try to prompt the user for an input and print the processedstring.
Answer to a) Write a function that takes a string as its argument If the word is 4 characters or shorter, return the argument in U…