Advertisement
davide1409

NoAlpha2

Nov 15th, 2019
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def noAlpha(s):
  2. #@param s: string
  3. #@return string
  4.   new_str = ''
  5.   for i in range(len(s)):
  6.     if not s[i].isalpha():
  7.       new_str+=s[i]
  8.      
  9.   return new_str
  10.  
  11.  
  12. def noAlpha1(s):
  13. #@param s: string
  14. #@return string
  15.   new_str = ''
  16.   c = 0
  17.   while(c<len(s)):
  18.     if not s[c].isalpha():
  19.       new_str+=s[c]
  20.     c+=1
  21.  
  22.   return new_str
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement