Copy this bookmark:



bookmark detail

code golf - Counting from 1 to an Integer - Programming Puzzles & Code Golf Stack Exchange
Python 2, 48 * 0.8 = 38.4

i=0;exec"i+=1;print format(i,'032b'),i;"*input()
Converts a number to binary, uses string formatting to convert it to binary with 32 digits, and then also prints the decimal number for the bonus. Uses an exec loop to increment from 1 to the input value.
python  codegolf  Matasano 
july 2015 by HM0880
view in context