Reorganize snippets

This commit is contained in:
Angelos Chalaris
2023-05-03 21:19:02 +03:00
parent 7511813169
commit 5c913d20bd
1240 changed files with 992 additions and 0 deletions

22
python/s/to-hex.md Normal file
View File

@@ -0,0 +1,22 @@
---
title: Number to hex
type: snippet
language: python
tags: [math]
cover: green-plant
dateModified: 2020-10-09T09:45:47+03:00
---
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
```