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 function named change() that has an integer parameter and six integers reference parameters named hundreds, fifties, twe
Dmitry_Shevchenko [17]

Answer:

The code for this question is attached below:

8 0
3 years ago
Domain of (x+8)/(x(x+10))
UkoKoshka [18]
The domain of this, assuming it's a function, is all real numbers such that x does not equal zero or negative ten.

In interval notation, this is (-∞, -10) U (-10, 0) U (0, <span>∞).

In set builder notation, this is {x | x </span>≠ -10, x <span>≠ 0}.

These inputs are excluded from the domain because they would otherwise allow division by zero. Try plugging in one of the restricted inputs. You'll see that it does not work! On a graph of this </span>function, you will see vertical asymptotes. 

5 0
3 years ago
Add my sna-p dkarpik58?...
BARSIC [14]

<u><em>This is for answers not snap</em></u>

7 0
3 years ago
2- There are many different design parameters that are important to a cache’s overall performance. Below are listed parameters f
katen-ka-za [31]

Answer:

1. 2588672 bits

2. 4308992 bits

3. The larger the data size of the cache, the larger the area of ​​memory you will need to "search" making the access time and performance slower than the a cache with a smaller data size.

Explanation:

1. Number of bits in the first cache

Using the formula: (2^index bits) * (valid bits + tag bits + (data bits * 2^offset bits))

total bits = 2^15 (1+14+(32*2^1)) = 2588672 bits

2. Number of bits in the Cache with 16 word blocks

Using the formula: (2^index bits) * (valid bits + tag bits + (data bits * 2^offset bits))

total bits = 2^13(1 +13+(32*2^4)) = 4308992 bits

3. Caches are used to help achieve good performance with slow main memories. However, due to architectural limitations of cache, larger data size of cache are not as effective than the smaller data size. A larger cache will have a lower miss rate and a higher delay. The larger the data size of the cache, the larger the area of ​​memory you will need to "search" making the access time and performance slower than the a cache with a smaller data size.

5 0
3 years ago
What is responsible for recording an image of an object with camera <br> Pls I neeed it right know
zavuch27 [327]
Wouldn’t you be the one responsible since your the one taking the image?
3 0
3 years ago
Other questions:
  • The analog signals that carry analog or digital data comprise composites built from combinations of simple sine waves.
    12·1 answer
  • "The pkill command terminates _________."
    14·1 answer
  • What is safe mode?
    9·1 answer
  • WHERE WAS THE CHEESEBURGER INVENTED?
    9·1 answer
  • The process of adding a header to the data inherited from the layer above is called what option below
    8·1 answer
  • discuss the benefits of normalization, and do you think we should normalize our designs to higher levels than 3NF? Why or why no
    9·1 answer
  • In this lab you will learn about the concept of Normal Forms for refining your database design. You will then apply the normaliz
    15·1 answer
  • What is the second step when designing an algorithm?
    12·2 answers
  • A leading global vendor Of computer software hardware for computer mobile and gaming systems and cloud services it's corporate h
    14·1 answer
  • What is the optimal number of members for an Agile team?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!