Advertisement
CR7CR7

crdig

Sep 24th, 2022
895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. N = input()
  2.  
  3. def sum_from_string(N):
  4.     """Returns sum of numbers in a string"""
  5.     return sum([int(i) for i in N if i not in "-."])
  6.  
  7. N = str(sum_from_string(N))
  8. while(int(N)>9):
  9.     N = str(sum_from_string(N))
  10.  
  11. print(N)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement