pastebin

Paste Search Dynamic
Recent pastes
sum list
  1. while true:
  2.     sum=0
  3.     count =1
  4.     sum_list=[]
  5.     n = int(input())
  6.  
  7.     if n == -1:
  8.         break
  9.  
  10.     while n>sum:
  11.         if n%count==0:
  12.             sum+=count
  13.             sum_list.append(count)
  14.         count += 1
  15.     if n==sum:
  16.         word = " + ".join(map(str,sum_list))
  17.         print(f"{n} = {word}")
  18.     else:
  19.         print(f'{n} is NOT perfect.')
  20.         continue
  21.  
Parsed in 0.004 seconds