Problem 2

Give the binary representation of a non-zero positive integer n.

For example, for n == 14, the program should output 0b1110.

Please do not use bin(.) built-in function.

Functions:

repr_binary(n)

Represent n as a binary number.

repr_binary(n: int) str[source]

Represent n as a binary number.

Requires
  • n > 0

Ensures
  • bin(n) == result