Error type in my work about python
<pre><code>#!/usr/bin/env python
# coding=utf8
  value=input("please enter value:")
  result=hex(value)
  r=hex(0xffff-result)
  print r
  print result


TypeError: unsupported operand type(s) for -: 'int' and 'str'
</code></pre>

<p>I study python for a few days,I try this python job,I can't understand what's the shape of '0xffff',it is str or int?and it's right for 'result' be str?</p>

<p><code>hex</code> returns a string containing the hexadecimal representation of the given <code>value</code>. You don't need to convert the value to hex, though, since <code>0xffff</code> is just an <code>int</code> literal.</p>

<p>Don't use <code>input</code> in Python 2; use <code>raw_input</code> to get a string, then explicitly (try to) convert the string to the value of the desired type.</p>

<pre><code>value = raw_input("Please enter a value: ")
r = 0xffff - int(value)
print r      # Print the result as a decimal value
print hex(r) # Print the result as a hexadecimal value 
</code></pre>

python