bin()

bin(number)
number :input number in decimal
Return the binary number as string.

Examples

num=5
print(bin(num)) # 0b101
num=47
print(bin(num)) # 0b101111
In our binary output, 0b is allways prefixed. As the output is a string we can remove it like this
num=47
num1=bin(num)
print(num1[2:]) # 101111
Without using bin() and by using format()
num=47
print(format(num,'b')) # 101111
max() Bitwise operators using bin() any()



plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer