title: Python error 'str' object has no attribute 'randrange'
body: <p>What causes this error in python?</p>
  
  <pre><code>Traceback (most recent call last):
    File "F:/coding/python/python programming for absolute beginners/chapter 4/
    The Jumble Game.py", line 9, in &lt;module&gt;
      p=random.randrange(len(word))
  AttributeError: 'str' object has no attribute 'randrange'
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>import random
  print"\t\t\tThe Jumble Game"
  print"In this program you will be given a jumble word and you have to guess that word"
  set=("book","parrot","rabbit")
  word=random.choice(set)
  random=""
  jumble=""
  while(word):
      p=random.randrange(len(word))
      random=random+word[position]
      word=word[:position]+word[(position+1):]
  print("The jumble word is",random)
  </code></pre>