Phone

+919997782184

Email

support@roboticswithpython.com

Geeks of Coding

Join us on Telegram

Home Forums Cody Bank Calculation of Number of Upper and Lower Cases using Python Program

Viewing 0 reply threads
  • Author
    Posts
    • #272
      Abhishek TyagiAbhishek Tyagi
      Keymaster

      Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.

      Input Format:
      The first line of the input contains a statement.

      Output Format:
      Print the number of upper case and lower case respectively separated by a space.

      Example:

      Input:
      Hello world!

      Output:
      1 9

      ###Code Starts from here###

      @author: Abhishek_Tyagi

      s = input()
      d={“UPPER CASE”:0, “LOWER CASE”:0}
      for c in s:
      if c.isupper():
      d[“UPPER CASE”]+=1
      elif c.islower():
      d[“LOWER CASE”]+=1
      else:
      pass
      print(d[‘UPPER CASE’],d[‘LOWER CASE’])

Viewing 0 reply threads
  • You must be logged in to reply to this topic.