Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python format to print dec oct hex and bin

n = int(input())
w = len("{0:b}".format(n))
for i in range (1, n+1):
  print("{0:{width}d}{0:{width}o}{0:{width}X}{0:{width}b}".format(i, width=w))
Comment

PREVIOUS NEXT
Code Example
Python :: print nested list in new lines in python 
Python :: python difference between unique and nunique 
Python :: call materialized view in django postgres 
Python :: how to convert 24 hours to 12 hours in python 
Python :: remove newlines from csv 
Python :: django text area limit characters 
Python :: how to check if a proxy is dead in python 
Python :: browser refresh selenium python 
Python :: permutations python 
Python :: remove consecutive duplicates python 
Python :: python convert datetime.timedelta into seconds 
Python :: selenium refresh till the element appears python 
Python :: default requires 2 arguments, 1 provided 
Python :: split dataset into train, test and validation sets 
Python :: python system of nonlinear equations 
Python :: python csv dictwriter 
Python :: numpy stdev 
Python :: django import timezone 
Python :: django import settings variables 
Python :: how to make game on python 
Python :: english to japanese 
Python :: avatar discord.py 
Python :: pyspark min column 
Python :: tf.contrib.layers.xavier_initializer() tf2 
Python :: Why do we use graphs? 
Python :: from time import sleep, time 
Python :: Extract Date from Datetime object 
Python :: pyqt pylatex 
Python :: get the system boot time in python 
Python :: how to sort list in descending order in python 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =