Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

python algorithm number to binary code example

Example: decimal to binary in python

a = 10
#this will print a in binary
bnr = bin(a).replace('0b','')
x = bnr[::-1] #this reverses an array
while len(x) < 8:
    x += '0'
bnr = x[::-1]
print(bnr)

Tags:

Python Example

Related

dataframe add column panda code example exclude method in testng yaml code example java for loop examples assign boolean value in python code example color code for bluie code example bash open file line by line code example js worker force wait for specified time code example best way to catch throw exception in c# code example sql %like% vs like vs equal code example boolean equals java custom code example grant all access to user in psql code example nodejs use class code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy