From 8f0718916da5a554473f83608dc2abf7490662ff Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Fri, 9 Oct 2020 09:45:47 +0300 Subject: [PATCH] Update and rename dec_to_hex.md to to_hex.md --- snippets/dec_to_hex.md | 18 ------------------ snippets/to_hex.md | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 snippets/dec_to_hex.md create mode 100644 snippets/to_hex.md diff --git a/snippets/dec_to_hex.md b/snippets/dec_to_hex.md deleted file mode 100644 index 5d7328c28..000000000 --- a/snippets/dec_to_hex.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: decimal to hexadecimal -tags: conversion, beginner ---- - -Returns hexadeciaml equivalent of decimal - -- Use `hex()` function for conversion - -```py -def conversion(dec): - return hex(dec) -``` - -```py -conversion(41) #29 -conversion(332) #14C -``` diff --git a/snippets/to_hex.md b/snippets/to_hex.md new file mode 100644 index 000000000..d516e563e --- /dev/null +++ b/snippets/to_hex.md @@ -0,0 +1,18 @@ +--- +title: to_hex +tags: math,beginner +--- + +Returns the hexadecimal representation of the given number. + +- Use `hex()` to convert a given decimal number into its hexadecimal equivalent. + +```py +def to_hex(dec): + return hex(dec) +``` + +```py +to_hex(41) # 0x29 +to_hex(332) # 0x14c +```