Advertisement
CR7CR7

cRoocked

Sep 24th, 2022
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import math
  2.  
  3. input_numbers = input()
  4. user_list = [int(a)for a in input_numbers if a.isdigit()]
  5.  
  6. total = 0
  7. while total < 9:
  8.    
  9.     for i in range(len(user_list)):
  10.         user_list[i] = int(user_list[i])
  11.         total += user_list[i]
  12.     if total < 9:
  13.  
  14.         print(total)
  15.         break
  16. else:
  17.     total= math.trunc(total)
  18.     total = sum(map(int, str(total)))
  19.    
  20.     print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement