title: while-loop to number 6174
body: <p>I'am beginner in programming and have struggled for a while with one task.
  Want to write a program wich finds out how many iterations is needed to arrive at the number 6174 from the specified number. </p>
  
  <p>For example.: if I take number 2341 and sort it.</p>
  
  <p>1) 4321-1234=3087<br>
   2) 8730-378=8352<br>
   3) 8532-2358=6174 (in this case it`s needed 3 iterations.) </p>
  
  <p>And I have to use ,,while loop,, that it runs a code until it comes to number 6174 and stops.</p>
  
  <p>I wrote a code:</p>
  
  <pre><code>n =input('write for nummbers ')
  n=str(n)
  i=0  
  i+=1     #"i" show how many times iteration happend.
  large = "".join(sorted(n, reverse=True))
  little = "".join(sorted(n,))
  n = int(large) - int(little)
  print(n, i)
  </code></pre>
  
  <p>Can you give mee some hint how I could run it with while loop. </p>