write a program that prompts for a sentence and calculates the number of uppercase letters, lowercase letters, digits and punctuations. output the results neatly formatted and labeled in columns.
import string
def string_test(s):
d={"UPPER_CASE":0,
"LOWER_CASE":0,"digit":0,"punctuation":0}
for c in s:
if c.isupper():
d["UPPER_CASE"]+=1
elif c.islower():
d["LOWER_CASE"]+=1
elif c.isdigit():
d["digit"]+=1
else:
for i in c:
if i in string.punctuation:
d["punctuation"]+=1
print ("Original String : ", s)
print ("No. of Upper case characters : ",
d["UPPER_CASE"])
print ("No. of Lower case Characters : ",
d["LOWER_CASE"])
print ("No. of digit: ", d["digit"])
print ("No. of punctutation : ",
d["punctuation"])
s=input("Enter a sentence:")
string_test(s)
OUTPUT:-
Enter a sentence:I am Supriyo,My age is 23. Original String : I am Supriyo,My age is 23. No. of Upper case characters : 3 No. of Lower case Characters : 14 No. of digit: 2 No. of punctutation : 2
write a program that prompts for a sentence and calculates the number of uppercase letters, lowercase...
Write a program that prompts for a sentence and calculates the number of uppercase letters, lowercase letters, digits, and punctuation. Output the results neatly formatted and labeled in columns. how I can make this program in a more simple way. # get user input user_string = input("Enter a sentence: ") # create and initialize variables upper_case = 0 lower_case = 0 digits = 0 spaces = 0 punctuations = 0 x = len(user_string) #loop conditions and increment for i in...
Can you write a program to convert a string from uppercase to lowercase and lowercase to uppercase depending on the user's input? In simple C++ please So for example if the input is Hello then the output should be hELLO
Write a C program that prompts the user for an input string with all lowercase letters. Your program should then sort the characters in the string and print the sorted string. Assume that the string contains no spaces and has at most 30 lowercase characters. Your program should loop continually until the user enters “q” to quit.
Define a function that counts the number of lowercase and uppercase letters in an input C-String. DO NOT DEFINE TWO SEPARATE FUNCTIONS. (in C++)
Context Free Grammar for the language of C++ identifiers consisting of uppercase and lowercase letters, digits, and the underscore character ‘_’, and starting with a letter or underscore
Exercise #3: write a Java program that prompts the user to enter a sentence. The program has to find the print: a. the position of vowels in the sentence. b. the number of vowels in the sentence (A, a, U, u, E, e, O, o, I, i) c. the number of characters as numbers or special characters (other than English letters a.z, A..Z). Hint: remember to ignore the spaces. Sample input-output: Enter the sentnse: UAEU is the university of the...
Write a ALP that inputs a string and let's the user choose from uppercase or lowercase and vowel and consonant the characters/string to be saved in file. ASSEMBLY LANGUAGE MASM Sample output: Enter a string: RoSE A uppercase vowel B. Lowercase vowel C. Uppercase consonant D.Lowercase consonant Enter choice: c Saving... Program used is emu8086
Write a program that reads a line of text, changes each uppercase letter to lowercase, and places each letter both in a queue and onto a stack. The program should then verify whether the line of text is a palindrome (a set of letters or numbers that is the same whether read forward or backward). please use c++ language and use own queue class or class provided. plese do not use queue library. please use functions.
CSC-295 Spring 2019 Assignment – String, StringBuilder and StringBuffer Write an application that prompts the user for a password that contains at least two uppercase letters, at least three lowercase letters, and at least one digit. Continuously reprompt the user until a valid password is entered. Display Valid password if the password is valid; if not, display the appropriate reason(s) the password is not valid as follows: The password did not have enough of the following: uppercase letters lowercase letters...
Write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all strings of two or more blanks should be compressed to a single blank. The sentence should start with an uppercase letter but should contain no other uppercase letters. Do not worry about proper names; if their first letters are changed to lowercases, that is acceptable. Treat...