Python script- need help understanding this while loop : <p>My gf is studying CS and needs help understanding how this script runs and why?</p>

<p>What value does mystery(9870) return?</p>

<pre><code>def mystery(n):  

m = " "
    while n &gt; 0:
    m += str(n % 10)
    n //= 10
return m
</code></pre>

<p>The possible answers are-
"789"
"0789"
"7890"
"987"
"9870"</p>

<p>We just need to know how the code runs?</p>

<p>Can anyone help?</p>
