Advertisement
stefbrad15

Clean String Challenge

Apr 19th, 2022
1,063
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data = 'z342512b?333~h123>n<724BB400*a'
  2. temp_str = ""
  3. output = []
  4.  
  5. for char in data:
  6.     if char.isnumeric():
  7.         temp_str += char
  8.         if len(temp_str) == 3:
  9.             output.append(int(temp_str))
  10.             temp_str = ""
  11.  
  12. output.sort()
  13. print(output)
Advertisement
RAW Paste Data Copied
Advertisement