Programmin-in-Python

Finding the Number of CamelCased Words in a String

Dec 26th, 2020 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. from string import ascii_uppercase
  2.  
  3. def camelcase(s):  
  4.     no = 0
  5.  
  6.     for i in s:
  7.         if i in ascii_uppercase:
  8.             no += 1
  9.  
  10.     return no + 1
  11.    
  12. val = camelcase("oneTwoThree") # All the letters of the First Word should be in Lower Case...
  13. print(val)
Add Comment
Please, Sign In to add comment