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]
4 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]4 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
What happens in Word 2016 when the Home ribbon tab is clicked on? A dialog box is launched, containing functions relating to the
ArbitrLikvidat [17]

A group with functions relating to font and tables will open.

3 0
3 years ago
Read 2 more answers
Many bookstores have closed since the rise of the Internet. What type of
agasfer [191]

Answer:

D

Explanation:

If bookstores, which are businesses that have to turn a profit, close down because of the internet, this is primairly economic impact.

3 0
3 years ago
Aaron is staying at a hotel that charges $100 per night plus tax for a room. A tax of 8% is applied to the room rate per day and
DerKrebs [107]

Answer:

We use the Python language to implement the code, if you have and IDE, simply copy and paste the code and run it

Note: the cost function is  c=(R+ .08*d)+5

Explanation:

#initialize some variables

T = 0.08 # tax for each day

F = 5.00 # one time fee

R = 100 # room rate

d = int(input("Enter the number of days stayed at the hotel "))

c = 0 # initialize cost variable

if (d > 0):

   c=(R+ .08*d)+5

   print(" the cost for ", d, " days is ", c )

else:

   print(" Invalid entry for days ", d )

7 0
3 years ago
After seeing strange traffic passing through a client's DMZ network, your client has asked you to install software that will mon
Viktor [21]

Answer: Log Analyzer

Explanation:

Log Analyzer  is the software application that is used for perceiving, reviewing and understanding the records that gets created through computer.These generated records are data logs which holds the information about activities and statistics of the web and computer.

  • According to the question, log analyzer should be used by so that traffic or any web server or network related issues can be analysed , monitored and diagnosed
  • Accordingly application management process can be implemented after log analysis take places by producing log data and information about web server.

3 0
3 years ago
Read 2 more answers
? Lodo con nutrientes que fertiliza las cosechas¿​
meriva

Answer:

I don't understand sorry

4 0
3 years ago
Other questions:
  • You hear someone make the following comment: "A blueprint is a design for a house. A carpenter can use the blueprint to build th
    15·1 answer
  • Most students overestimate their skill level and abilities to take open book tests.
    11·2 answers
  • In 125 words describe the steps to active listening.
    6·1 answer
  • Which best describes a career that would rely on both and employer and the federal government for funding? Electro-Mechanical Te
    5·1 answer
  • Refer to the color wheel to identify the color scheme.
    13·1 answer
  • How to type the horizontal line on Mac ? Please I need to finish my assignment
    8·1 answer
  • I need help figuring out 2 pictures with topics that I can put on a magazine about the serengeti. This is something I'm doing fo
    11·2 answers
  • Your manager has requested you keep a timesheet showing how many hours you work each day and what projects you work on during th
    13·2 answers
  • Why can't I register for Brainly?? I've been trying for months, too! I've noticed this question has been asked so many times, bu
    7·1 answer
  • Comparing tools made of stone, iron, and bronze: place them in the correct order from least to most durable.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!