Rewriting "do while" loop from java to python : <p>I am trying to rewrite the following piece of java code to python:</p>

<pre><code>class pcp {
    public static void main(String[] args) {
        final int b = 13;
        final int m = 1000;
        int a0 = 1;
        int mas[] = new int[10];
        int a = a0, T = 0;
        do {
            System.out.print(a + " ");
            a = (b * a) % m;
            T++;
            mas[a * 10 / m]++;
        } while (a != a0);
        System.out.print("\n" + T + "\n");
        for (int i = 0; i &lt; mas.length; i++)
            System.out.print(mas[i] + " ");
    }
}
</code></pre>

<p>It's a simple pseudo random number generator with the following output:</p>

<pre><code>1 13 169 197 561 293 809 517 721 373 849 37 481 253 289 757 841 933 129 677 801 413 369 797 361 693 9 117 521 773 49 637 281 653 489 357 641 333 329 277 601 813 569 397 161 93 209 717 321 173 249 237 81 53 689 957 441 733 529 877 401 213 769 997 961 493 409 317 121 573 449 837 881 453 889 557 241 133 729 477 201 613 969 597 761 893 609 917 921 973 649 437 681 853 89 157 41 533 929 77

100

11 9 11 9 11 9 11 9 11 9 
</code></pre>

<p>Here's my Python code:</p>

<pre><code>b = 13
m = 1000
a0 = 1
mas = [0] * 10
a = a0
T = 0

while not (a != a0):
    print(a)
    a = (b * a) % m
    T = T + 1
    mas[int(a * 10 / m)] = mas[int(a * 10 / m)] + 1

print(T)

i = 0
while (i &lt; len(mas)):
    print(mas[i])
    i = i + 1
</code></pre>

<p>It simply won't enter the loop an I'm kinda at loss about how rewrite it in the correct way for python.</p>

<p>Thank you for reading and your help.</p>
