1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zaharov [31]
3 years ago
14

Write a program with a function that accepts a string as an argument and returns the number of uppercase, lowercase, vowel, cons

onants, and punctuation that the string contains. The application should let the user enter a string and should display the number of uppercases, lowercases, vowels, consonants, and punctuations that the string contains.
Computers and Technology
1 answer:
diamong [38]3 years ago
8 0

Answer:

Explanation:

The following code is written in Python. It is a function called checkString that takes in a string as an argument and loops through each char in that string and checking to see if it is lowercase, uppercase, vowel, consonant, or punctuations. It adds 1 to the correct variable. At the end of the loop it prints out all of the variables. The picture below shows a test output with the string "Brainly, Question."

def checkString(word):

   uppercase = 0

   lowercase = 0

   vowel = 0

   consonants = 0

   punctuation = 0

   vowelArray = ['a', 'e', 'i', 'o','u', 'y' ]

   consonantArray = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']

   punctuationArray = ['.', '!', '?', ',', ';', '(', ')']

   for char in word:

       if char.isupper():

           uppercase += 1

       else:

           lowercase += 1

       if char.lower() in vowelArray:

           vowel += 1

       elif char.lower() in consonantArray:

           consonants += 1

       if char in punctuationArray:

           punctuation += 1

   print('Uppercase: ' + str(uppercase))

   print('Lowercase: ' + str(lowercase))

   print('Vowels: ' + str(vowel))

   print('Consonants: ' + str(consonants))

   print('Punctuations: ' + str(punctuation))

You might be interested in
Which is an acceptable practice when a photographer shoots in windy conditions?
VARVARA [1.3K]

Answer:

d) attach a bag of weights to the tripod

Explanation:

5 0
3 years ago
1. Which of the following statements is true regarding the use of refrigerants?
kondaur [170]
A) Records of the dates and quantities of refrigerant recovered and recycled are unnecessary
5 0
3 years ago
Read 2 more answers
Write the prototype for a function named showSeatingChart that will accept the following two-dimensional array as an argument. c
barxatty [35]

Answer:

See explaination

Explanation:

void showSeatingChart(string seatingChart[20][40], const int ROWS, const int COLS){

for(int i = 0;i<ROWS;i++){

for(int j = 0;j<COLS;j++){

cout<<seatingChart[i][j]<<" ";

}

cout<<endl;

}

}

4 0
3 years ago
arla made a spreadsheet in Excel showing the projected costs for a concert she was putting on. What can Marla enter into cell A1
svp [43]

Marla can enter Food for examble for A11 on the exl page

3 0
3 years ago
The most likely reason a firm would decide to establish an extranet would be the desire to Multiple Choice speed the flow of inf
brilliants [131]

Answer: share information and collaborate with a select group of outside organizations or individuals.

Explanation:

When a company uses an intranet, it is for the purpose of sharing information within the company so in the same vein, an extranet is done to share information with entities outside the company be it people or organizations.

For information to be shared, the other companies and organizations need to have the means and authorization to join the extranet. Extranets are very useful as they enable collaboration across vast distances thereby increasing productivity.

6 0
3 years ago
Other questions:
  • What are Three types of informational references
    9·2 answers
  • What is computer? Explain the characteristics of computer.<br>​
    12·1 answer
  • Which option should you select to ignore all tracked changes in a document
    6·1 answer
  • How to eject a flash drive from chromebook?
    6·1 answer
  • A network engineer is configuring a network to be able to relay IPv6 packets. The network only supports IPv4 and does not have d
    11·1 answer
  • Identify the primary responsibilities associated with each of the following web design roles: content writer/editor, artist/grap
    13·1 answer
  • When might be the best time to start saving for retirement?
    5·2 answers
  • A column letter above the grid, also called the ____, identifies each column.
    9·1 answer
  • 1.Which one of the following buttons returns a window to its original size?
    11·1 answer
  • We can improve our knowledge and skills on animals and fish raising with the use of internet​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!