title: Rotate a word in Python with a key
body: <blockquote>
    <p>Write a function called <code>rotate_word()</code> that takes a string and an integer as parameters, and returns a new string that contains the letters from the original string rotated by the given amount. <code>Rotate_word('cheer',7) == 'jolly'</code>, <code>Rotate_word('melon', -10) = 'cubed'</code>,**</p>
  </blockquote>
  
  <p>My Python code is: </p>
  
  <pre><code>def Rotate_word(str_, num_):
      result = ''
      for i in str_:
          i = chr(ord(i) + num_)
          result = result + i
      return (result)
  
  str_ =input("Enter a string: ")
  num_ = int(input("Enter rotate number: "))
  print (Rotate_word(str_,num_))
  </code></pre>
  
  <p>It gives output like:  </p>
  
  <pre><code>Enter a string: cheer  
  Enter rotate number: 7  
  jolly   
  </code></pre>
  
  <p>Which is correct.</p>
  
  <pre><code>Enter a string: melon  
  Enter rotate number: -10  
  c[bed  
  </code></pre>
  
  <p>This is wrong the correct answer is <code>cubed</code></p>
  
  <p>What am I doing wrong and how can I fix it?</p>