Skip to content
This repository has been archived by the owner on Apr 1, 2021. It is now read-only.

Commit

Permalink
Article: Python Hex Function (#1033)
Browse files Browse the repository at this point in the history
* Create Python-Function-Hex.md

For issue #819

* Update Python-Function-Hex.md

* Update Python-Function-Hex.md
  • Loading branch information
nj4710 authored and Jonathan committed May 26, 2016
1 parent 0995aa8 commit 28e970f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Python-Function-Hex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Python hex(x)

`hex(x)` is a built-in function in Python 3 to convert an integer number to a lowercase [hexadecimal](https://www.mathsisfun.com/hexadecimals.html) string prefixed with “0x”.

## Argument

This function takes one argument, `x`, that should be of integer type.

## Return

This function returns a lowercase hexadecimal string prefixed with "0x".

## Example

```python
print(hex(16)) # prints 0x10
print(hex(-298)) # prints -0x12a
print(hex(543)) # prints 0x21f
```

:rocket: [Run Code](https://repl.it/CV0S)

[Official Documentation](https://docs.python.org/3/library/functions.html#hex)

0 comments on commit 28e970f

Please sign in to comment.