Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
binary
#python 2.7.12 def convert(n): if n == 0: return "0" pstr = '' while n: if n & 1 == 1: pstr = "1" + pstr else: pstr = "0" + pstr n /= 2 return pstr binaryNum = 6 print 'Entered Binary Number = ', binaryNum print 'Binary Representation = ',convert(binaryNum)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
0dd08b977895229d09b4848e467a4e10162ed345de0b245922b3505909d33ead
PyProperty
single_digit
PyClassInit
functional python - from hackernoon.com, lean functional python in 10 min
list function
Speed up Python2 nested loops with XOR
Gettinginput from users
gameboy
GayChicken
Please log in to post a comment.