Need help with python. Hex converting.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lazyjacket
    New Member
    • Sep 2006
    • 2

    Need help with python. Hex converting.

    I've just started with python, and need some help.

    Decimal = raw_input('Ente r your decimal number: ')
    hex = hex()
    print "Your Hexadecimal is " + hex

    is the code. and the problem is that i cant get number im punching in the raw_input field to appear in the () after the text. this is the error, Enter your decimal number: 110101
    Traceback (most recent call last):
    File "C:\Python24\py thon\hex.py", line 2, in ?
    hex = hex()
    TypeError: hex() takes exactly one argument (0 given).. does any one here, know what i need to do to acomplish my goal?
  • ghostdog74
    Recognized Expert Contributor
    • Apr 2006
    • 511

    #2
    Originally posted by lazyjacket
    I've just started with python, and need some help.

    Decimal = raw_input('Ente r your decimal number: ')
    hex = hex()
    print "Your Hexadecimal is " + hex

    is the code. and the problem is that i cant get number im punching in the raw_input field to appear in the () after the text. this is the error, Enter your decimal number: 110101
    Traceback (most recent call last):
    File "C:\Python24\py thon\hex.py", line 2, in ?
    hex = hex()
    TypeError: hex() takes exactly one argument (0 given).. does any one here, know what i need to do to acomplish my goal?
    the error message says it all.
    you need an argument to hex()....eg hex(some_argume nt)...
    i guess you know what to do now..

    Comment

    • lazyjacket
      New Member
      • Sep 2006
      • 2

      #3
      Originally posted by ghostdog74
      the error message says it all.
      you need an argument to hex()....eg hex(some_argume nt)...
      i guess you know what to do now..

      the problem is that i dont what argument to use, just started up with python (total noob)

      Comment

      • ghostdog74
        Recognized Expert Contributor
        • Apr 2006
        • 511

        #4
        Originally posted by lazyjacket
        the problem is that i dont what argument to use, just started up with python (total noob)
        Decimal = raw_input('Ente r your decimal number: ')
        hex = hex()
        print "Your Hexadecimal is " + hex
        you want to change Decimal to hex , right?
        so the argument to hex is Decimal...like this hex(Decimal) .

        Comment

        Working...