Write a program that accepts a sentence and calculate the number of upper case and lower case. Ex -Hello. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a program that accepts a sentence and calculate the number of upper case and lower case. Ex -Hello.

I want coding and explainations

1st Jun 2017, 4:14 PM
lorshan
lorshan - avatar
2 Answers
+ 2
I'll just answer in theory, use r"[A-Z]" and re.findall to collect a list of capital letters in the string. Of course though you must first convert the string into a list so you can see observe each character. Length of that list is the number of caps letters. Figure out how to do it for lowercase as well. Edit: Complete the python course, if you did you would have known this.
1st Jun 2017, 5:00 PM
Simon
Simon - avatar
+ 14
Did you post another homework here, right? :3 You can use lower( ) and upper( ), do your homework with your efforts only, trust me, you'll learn new things and it will help you to understand better Python. :)
1st Jun 2017, 4:23 PM
Maz
Maz - avatar