Write a program continuously asks the user to enter a sentence until they type "-999". It should call FUNCTIONS to do the following: Collect the uppercase, lowercase, whitespace, digits and punctuation characters that are contained in the sentence WITHOUT DUPLICATES Output: Be sure to LABEL and PRINT the following: • uppercase letters (sorted A-Z) WITHOUT DUPLICATES lowercase letters (sorted A-Z) WITHOUT DUPLICATES • digits (sorted from HIGHEST to LOWEST) WITHOUT DUPLICATES punctuation whitespace WITHOUT DUPLICATES (note – whitespace includes space, tab, newline)
Please use python program.


#the function definition for uppercase
def Uppercase(sentence,n):
upper=''
for i in range(n):
if(sentence[i].isupper()):
upper+=sentence[i]
print("UPPERCASE")
print(sorted(set(upper)))
#the function definition for lowercase
def lowercase(sentence,n):
lower=""
for i in range(n):
if(sentence[i].islower()):
lower+=sentence[i]
print("LOWERCASE")
print(sorted(set(lower)))
#the function definition for digits
def digitcase(sentence,n):
digits=""
for i in range(n):
if(sentence[i].isdigit()):
digits+=sentence[i]
print("Digits")
print(sorted(set(digits)))
#the function definition for whitespace
def Whitespace(sentence,n):
spaces=""
for i in range(n):
if(sentence[i].isspace()):
spaces+=sentence[i]
print("WhiteSpace")
print(sorted(set(spaces)))
sentence=input("Enter the Sentence:")
n=len(sentence)
Uppercase(sentence,n)
lowercase(sentence,n)
digitcase(sentence,n)
Whitespace(sentence,n)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









