Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = 587
- lownum = 0.3525
- base = 6
- iterstop = 4
- def full(num, base):
- basearray = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
- print "{|\n|-"
- while num > 0:
- print "|",num,"|| mod",base," ||",basearray[(num % base)],"\n|-"
- num = (num - (num % base)) / base
- print "|}"
- def half(num, base, iterstop):
- basearray = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
- print "{|\n|-\n!Zahl!!Operation!!Rest\n|-"
- for i in range(0,iterstop):
- full = int(num * base)
- print "|",num,"||<math>\lfloor ",num,"*",base," \\rfloor</math> ||", basearray[full],"\n|-"
- num = (num * base) - full
- print "|}"
- full(num, base)
- half(lownum, base, 7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement