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
Write a program to compute the sum of digits in a number given by the user. You must use your own function to compute the sum of
Sergio [31]

Answer:

python program compute the sum of digits of a number using function.....hope this answer is perfect and better for urr question....thanks

4 0
3 years ago
What is the output?<br> &gt;&gt;&gt; password = "sdf#_356"<br> &gt;&gt;&gt; password.isalnum()
Nat2105 [25]

Answer:

Think the output is False because the string password contains #.

Explanation:

please rate Brailliest if you happy. keep in touch if you need any further assistance.☺️

8 0
3 years ago
Read 2 more answers
What is true about music from the Romantic period?
avanturin [10]
The answer to the given question above is the third option: <span>It was longer and less constrained than the music of the Classical period. The Romantic Period in music actually has more freedom in design and form. During this period, music were even more artistic and intellectual as well. Romantic Period occurred the late 18th century until early 19th century.</span>
8 0
3 years ago
Read 2 more answers
"Bullet Lists" can be which of the following?
MariettaO [177]

Answer:

letters and numbered

Explanation:

7 0
4 years ago
Read 2 more answers
In which type of network can a computer upload and download data at the same time?
REY [17]

answer is peer-to-peer


hope this helps

8 0
3 years ago
Other questions:
  • Poems Roses are red,
    15·1 answer
  • Which feature of Microsoft power point make tiles fly in on the clock of a mouse
    8·1 answer
  • What can be said about the equipment used by photographers during the Civil War?
    13·2 answers
  • What are the requirements to connect the Internet?<br>plz answer it.....​
    10·1 answer
  • You have a network of ten computers connected to a single switch that has 12 ports. You need to add six more computers to the ne
    12·1 answer
  • Which is NOT a joint?<br> A. <br> Femur<br> B. <br> Knee<br> C. <br> Elbow
    13·2 answers
  • When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your d
    14·1 answer
  • A test's directions often clarify any questions a student might have about answering a response question.
    5·2 answers
  • An engineer is designing an HTML page and wants to specify a title for the browser tab to display, along with some meta data on
    12·1 answer
  • PLEASE HELP!
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!