title: Python : parasitic number
body: <p>In general, a positive natural number that can be multiplied by n 
  by moving the rightmost digit to the front of the number is called an n 
  -parasitic number. Here n is itself a single-digit positive natural number. For example: 4×128205=512820 
           4×128205=512820
  so 128205 is a 4-parasitic number. Natural numbers with leading zeros are not allowed. So even though 
  4×025641=102564 
  4×025641=102564
  the number 025641 is not 4-parasitic.  </p>
  
  <p>Assignment: write a function parasitic that takes a natural number. In case the given natural number is n-parasitic, the function must return the value n. Otherwise, the function must return the value 0.</p>
  
  <p>My code (last definition parastic(number)) is not working for some cases for example: parasitic(142857)
  n = 5 while with my code I return 0.</p>
  
  <pre><code>def rotateLeft(number):
      """
      &gt;&gt;&gt; rotateLeft(717948)
      179487
      &gt;&gt;&gt; rotateLeft(142857)
      428571
      &gt;&gt;&gt; rotateLeft(105263157894736842)
      52631578947368421
      """
  
      k = str(number)
      letter = k[:1]
      numb = k[1:]
      resultaat = str(numb) + str(letter)
      return int(resultaat)
  
  
  
  def rotateRight(number):
      """
      &gt;&gt;&gt; rotateRight(179487)
      717948
      &gt;&gt;&gt; rotateRight(428571)
      142857  
      &gt;&gt;&gt; rotateRight(52631578947368421)
      15263157894736842
      """
  
      k = str(number)
      letter = k[-1]
      numb = k[:-1]
      resultaat = str(letter) + str(numb)  
      return int(resultaat)
  
  def parasitic(number):
      """
      &gt;&gt;&gt; parasitic(179487)
      4
      &gt;&gt;&gt; parasitic(142857)
      5
      &gt;&gt;&gt; parasitic(105263157894736842)
      2
      &gt;&gt;&gt; parasitic(1234)
      0
      """
  
  
      count = 0
      getal = count * number
  
      while getal != rotateLeft(number):
          count += 1
          getal = count * number
          if getal == rotateLeft(number):
              break
              return (count)
          else:
              return 0
  </code></pre>