First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 8 years ago

nbruin gravatar image

Python (and hence sage) understand exactly the hexadecimal notation that you use here, so this just works:

sage: y = 0x0d * 0x0c
sage: y
156

As you can see, sage will normally print the integer in decimal, even if you have obtained it from integers inputted in hex (the way the integer is obtained is not part of what is remembered. Only its value is). If you want to print it in hex you can do:

sage: y.str(16)
'9c'