2.13. Binary Planet ¶
Marul is our friend who has come from another planet. In their planet, decimal representations of numbers are not common. Instead, they use binary representations.
Write a program to help Marul, which takes an integer and prints 8-bit binary representation of that integer as a string.
Sample I/O:
Input:
11
Output:
00001011
Input:
129
Output:
10000001
Input:
255
Output:
11111111
n = int(input())
s = ""
for i in range(7,-1,-1):
if n >= 2**i:
s+="1"
n-=2**i
else:
s+="0"
print(s)