Advertisement
Guest User

Correzione Soluzione Problema 1

a guest
Nov 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. def elimalphafor(str):
  2. # @param str : string
  3. # @return string    
  4.     rstr=""
  5.     for i in range(0,len(str)):
  6.          c=str[i]
  7.          if not(c.isalpha()):
  8.             rstr=rstr+c
  9.     return rstr
  10.    
  11. def elimalphawhile(str):
  12. # @param str : string
  13. # @return string
  14.     rstr=""
  15.     i=0
  16.     while i<(len(str)):
  17.           c=str[i]
  18.           if not(c.isalpha()):
  19.             rstr=rstr+c
  20.           i=i+1
  21.     return rstr
  22.    
  23. def elimdigitfor(str):
  24. # @param str : string
  25. # @return string    
  26.     rstr=""
  27.     for i in range(0,len(str)):
  28.          c=str[i]
  29.          if not(c.isdigit()):
  30.             rstr=rstr+c
  31.     return rstr
  32.    
  33. def elimdigitwhile(str):
  34. # @param str : string
  35. # @return string    
  36.     rstr=""
  37.     i=0
  38.     while i<(len(str)):
  39.           c=str[i]
  40.           if not(c.isdigit()):
  41.             rstr=rstr+c
  42.           i=i+1
  43.     return rstr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement