Update and rename convert_to_binary.md to to_binary.md

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-07 19:46:01 +03:00
committed by GitHub
parent 950f08cf72
commit f511b9189b
2 changed files with 17 additions and 17 deletions

View File

@ -1,17 +0,0 @@
---
title: convert_to_binary
tags: math,beginner
---
Returns the base 2 equivalent of a decimal number
- Use `bin()` to convert a given decimal number into binary equivalent
```py
def convert_to_binary(n):
return bin(n)
```
```py
convert_to_binary(100) # 0b1100100
```

17
snippets/to_binary.md Normal file
View File

@ -0,0 +1,17 @@
---
title: to_binary
tags: math,beginner
---
Returns the binary representation of the given number.
- Use `bin()` to convert a given decimal number into its binary equivalent.
```py
def to_binary(n):
return bin(n)
```
```py
to_binary(100) # 0b1100100
```