March 25, 2020 at 12:00 am
Comments posted to this topic are about the item Getting the Hex values
March 25, 2020 at 12:19 pm
The correct answer (according to me :D) isn't available in the list of answers. The correct answer would be to do it in T-SQL.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 26, 2020 at 7:27 am
Yesterday I gave up QotD after I couldn't decide which way was best. I wrote DecToHexa (n) function, which may be the answer # 1.
According to docs Built-in Functions this may be the answer # 3.
According to Type Conversion in Python, this may be the answer # 4.
But in my life sport sometimes taught me losing too. I swear I haven't looked for the right answer yet, and now I'm boldly answering # 4. Hmm... I got it wrong. Anyway thanks Steve for this funy question. Jeff was right ...
# Function definition is here
def DecToHexa(n):
result = str(hex(n))
return result;
# Now you can call DecToHexa function
n = 254
result = DecToHexa(n);
print('Hexadecimal value of '+ str(n) +' is: ' + result);
Result pane:
$python main.py
Hexadecimal value of 254 is: 0xfe
March 26, 2020 at 12:57 pm
Nice one, thanks Steve
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy