Programming + Boredom = ? 04-22-2014, 02:43 AM
#1
We've all had those moments when we have nothing to program, and we're bored to death. We just make some bullshit program or whatever. What are some programs that you've made from pure boredom?
Today I got so bored that I made a program that converts digital storage units. Which, for those of you who don't know, (and I'm sure you do, but if you don't, why are you programming?) the conversion rate is 1024.
Here you go. Completely useless, but here.
Today I got so bored that I made a program that converts digital storage units. Which, for those of you who don't know, (and I'm sure you do, but if you don't, why are you programming?) the conversion rate is 1024.
Here you go. Completely useless, but here.
Code:
class trans:
def kb_mb(mem): return ( int(mem) / 1024 )
def kb_gb(mem): return ( ( int(mem) / 1024 ) / 1024 )
def kb_tb(mem): return ( ( ( int(mem) / 1024 ) / 1024 ) / 1024 )
def mb_kb(mem): return ( int(mem) * 1024 )
def mb_gb(mem): return ( int(mem) / 1024 )
def mb_tb(mem): return ( ( int(mem) / 1024 ) / 1024 )
def gb_kb(mem): return ( ( int(mem) * 1024 ) * 1024 )
def gb_mb(mem): return ( int(mem) * 1024 )
def gb_tb(mem): return ( int(mem) / 1024 )
def tb_kb(mem): return ( ( ( int(mem) / 1024 ) / 1024 ) / 1024 )
def tb_mb(mem): return ( ( int(mem) / 1024 ) / 1024 )
def tb_gb(mem): return ( int(mem) / 1024 )
class prompt:
def get():
print('''Known errors:\nCan't convert "amazingly small" numbers.\ni.e. - Can convert 1 KB to TB, but cannot convert back.''')
print('Types\nkb, mb, gb, tb\n')
y = input('Type: ')
x = input('Value: ')
try:
y = y.lower()
xint = str(int(x))
if y == 'kb':
print(xint+' KB =\n'+
str(float(trans.kb_mb( x )))+' MB\n'+
str(float(trans.kb_gb( x )))+' GB\n'+
str(float(trans.kb_tb( x )))+' TB'
)
elif y == 'mb':
print(xint+' MB =\n'+
str(float(trans.mb_kb( x )))+' KB\n'+
str(float(trans.mb_gb( x )))+' GB\n'+
str(float(trans.mb_tb( x )))+' TB'
)
elif y == 'gb':
print(xint+' GB =\n'+
str(float(trans.gb_kb( x )))+' KB\n'+
str(float(trans.gb_mb( x )))+' MB\n'+
str(float(trans.gb_tb( x )))+' TB'
)
elif y == 'tb':
print(xint+' TB =\n'+
str(float(trans.tb_kb( x )))+' KB\n'+
str(float(trans.tb_mb( x )))+' MB\n'+
str(float(trans.tb_gb( x )))+' GB'
)
else:
print('How the fuck did this get an error? Are you retarded?')
except Exception as pef: print(pef)
if __name__ == '__main__':
prompt.get()![[Image: BXqGARG.png]](https://i.imgur.com/BXqGARG.png)









![[+]](https://sinister.li/images/modern/collapse_collapsed.png)


