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
Where is the viscosity of engine oil found
Rashid [163]
In the crankcase
I hope this helps
8 0
3 years ago
it says i have brainly plus subscripton but whenever i log onto brainly using my laptop, it says i don't have brainly plus and w
Sladkaya [172]

Answer:

Explanation:

I think you can try logging out from your account. Try cancelling your subscription. Before you do that, reach out to Brainly support.

4 0
3 years ago
Identify two entities and 2 of their attributes from the given scenario.
polet [3.4K]

Bookstore and BookSearch are the two entities for the given scenario.

Explanation:

  • For the given Book.com virtual store, there can be two entities like Bookstore and BookSearch.
  • Bookstore can have all the details of the books in the virtual store. hence the attributes can be
  • Bookstore attributes: bookname, Authorname, Publisher, Publishedyear, Agegroup, category.
  • BookSearch entity can be used to search the books in the virtual store.
  • Booksearch attributes: bookname, category, bookid, authorname.
8 0
3 years ago
Downlad the file and write a program named Lab10b_Act2.py that does the following: Opens the CSV file for reading Reads the CSV
a_sh-v [17]
他們會不會是因為這樣就是說他們的問題,他們會會覺得委屈覺得我
5 0
2 years ago
Which is the best method of marketing a game to casual players?
Phoenix [80]
A casual game is a video game targeted at or used by casual gamers. Casual games may exhibit any type of gameplay or genre. They are typically distinguished by simple rules and by reduced demands on time and learned skill, in contrast to more complex hardcore games. They typically impose low production and distribution costs on the producer. Casual games are often played on a personal computer online in web browsers, but are also popular on game consoles and mobile phones.

Hope this helped. Have a great day! :D
3 0
3 years ago
Read 2 more answers
Other questions:
  • Python
    14·1 answer
  • On the 74ls74 d flip-flop, the clk input has a small triangle. the pr (preset) and clr (clear) inputs have a circle. what do the
    15·1 answer
  • You can put a small level on your camera to help keep the horizons straight? TRUE OR FALSE
    14·2 answers
  • If a*b = 2a - 56, calculate the value of<br>3 * 4​
    14·1 answer
  • Why when I move stuff in Roblox Studio like an object or a Character. It tilts the opposite direction I'm moving it to with the
    6·2 answers
  • What is the decrypted binary
    9·1 answer
  • Binary Search:<br><br><br> 2 6 15 42 55 89 111 256
    6·1 answer
  • Help! I’ll mark you brainly! Please help me.
    15·1 answer
  • __________, a level beyond vulnerability testing, is a set of security tests and evaluations that simulate attacks by a maliciou
    10·1 answer
  • Hazel has taught herself a variety of computer languages. She enjoys using her knowledge to write the programs for applications
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!