Added decimal to hex conversion
This commit is contained in:
18
snippets/dec_to_hex.md
Normal file
18
snippets/dec_to_hex.md
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
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
|
||||
```
|
||||
Reference in New Issue
Block a user