Upper method doesn't make sense
<p><strong>Code</strong>:</p>

<pre><code>def solve_the_input(port):
    port = hex(int(port))
    split_result = port.split("0x")
    split_port = split_result[1]
    print 'input port is ',split_port
    split_port.upper()
    print 'input port is ',split_port
    return split_port

if __name__ == "__main__":
    if len(sys.argv) == 1:
        print "please input a port"
    else:
        port = solve_the_input(sys.argv[1])
</code></pre>

<p><strong>Input</strong></p>

<pre><code>python test.py 42328
</code></pre>

<p><strong>Actual Output</strong>:</p>

<pre><code>input port is  a558
input port is  a558
</code></pre>

<p><strong>Expected Output</strong>:</p>

<pre><code>input port is  a558
input port is  A558
</code></pre>

<p>I don't know why the upper() method is not working as expected.</p>

<p>Couple of points </p>

<ul>
<li><code>split_port.upper()</code> return is not assigned back to <code>split_port</code></li>
<li>No need to split on <code>'0x'</code>. You can use <code>replace</code> function instead. Will be less complicated.</li>
</ul>

<p><strong>Code with replace function:</strong></p>

<pre><code>import sys
def solve_the_input(port):
    port = hex(int(port))
    result = port.replace("0x",'')
    print 'input port is ',result
    result = result.upper()
    print 'input port is ',result
    return result

if __name__ == "__main__":
   if len(sys.argv) == 1:
       print "please input a port"
   else :
       port = solve_the_input(sys.argv[1])
</code></pre>

<p><strong>Output:</strong></p>

<pre><code>C:\Users\dinesh_pundkar\Desktop&gt;python c.py 1235
input port is  4d3
input port is  4D3

C:\Users\dinesh_pundkar\Desktop&gt;
</code></pre>

python