Advertisement
Guest User

Tool

a guest
Oct 19th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. num = 587
  2. lownum = 0.3525
  3. base = 6
  4. iterstop = 4
  5.  
  6. def full(num, base):
  7.     basearray = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
  8.     print "{|\n|-"
  9.     while num > 0:
  10.         print "|",num,"|| mod",base," ||",basearray[(num % base)],"\n|-"
  11.         num = (num - (num % base)) / base
  12.  
  13.     print "|}"
  14.  
  15. def half(num, base, iterstop):
  16.     basearray = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
  17.     print "{|\n|-\n!Zahl!!Operation!!Rest\n|-"
  18.     for i in range(0,iterstop):
  19.         full = int(num * base)
  20.         print "|",num,"||<math>\lfloor ",num,"*",base," \\rfloor</math> ||", basearray[full],"\n|-"
  21.         num = (num * base) - full
  22.     print "|}"
  23. full(num, base)
  24. half(lownum, base, 7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement