How to convert a number to hex number?

Steve Holden steve at holdenweb.com
Tue Nov 8 17:09:37 EST 2005


Paul Rubin wrote:
> Steve Holden <steve at holdenweb.com> writes:
> 
>>>Try hex(33**33).
>>
>>You're usually smarter than this, or am I missing some joke?
>>
>>  >>> hex(33*33)
>>'0x441'
> 
> 
> You used only one * (multiplication), I used two *'s (exponentiation).
> 
>     >>> hex(33**33)
>     '0x5857366DCE0162CB5DDCD1BF0FC7C03A6438304421L'

That makes sense. Sorry, a bit sleep-deprived today.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list