Binary Form

Computers store numbers in binary, using only 0 and 1. The function to_binary receives a non-negative integer n and converts it to a binary string without any extra prefix. For the number 0, return the string 0.

Примеры

Ввод
0
Вывод
"0"
Ввод
5
Вывод
"101"
Ввод
8
Вывод
"1000"

Нужно реализовать

def to_binary(n: int) -> str:

Теги

mathstrings
PostgreSQLv16

Hier verschijnt het resultaat van je code

Visible tests
1
Input
0
Expected"0"
2
Input
5
Expected"101"
3
Input
8
Expected"1000"
4
Input
255
Expected"11111111"
5
Input
1
Expected"1"
6
Input
999999
Expected"11110100001000111111"
Focus radio
Paused · SomaFM · Fluid