title: Why does the function not work properly when processing numbers?
body: <p>so I'm trying to get the of a given number. The thing is, the code prints the wrong message and it also doesn't work with all numbers. Why is that?</p>
  <p>This is the part to get the factors:</p>
  <pre><code>thefactors = []
              d = 2
              while d*d &lt;= number:
                  while (number % d) == 0:
                      factors.append(d) 
                      number //= d
                  d += 1
                  break
  
              if number &gt; 1:
                  factors.append(number)
                  print('The factors of {} are:'.format(number), thefactors)
  </code></pre>
  <p>What's going on and how do I fix it?</p>