Advertisement
EXTREMEXPLOIT

ME CAGO EN LA PUTA OSTIA QUE ASCO TODO

Sep 5th, 2019
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. def FormattedNumber(N):
  2.     NBin = bin(N)
  3.     l = len(NBin) - 1
  4.  
  5.     for i in range(1, N+1):
  6.         DEC = i
  7.         AuxOCT = list(oct(i))
  8.         AuxHEX = list(hex(i))
  9.         AuxBIN = list(bin(i))
  10.        
  11.         AuxOCT.pop(0)
  12.         AuxOCT.pop(0)
  13.         OCT = ""
  14.         for j in AuxOCT:
  15.             OCT += j
  16.  
  17.         AuxHEX.pop(0)
  18.         AuxHEX.pop(0)
  19.         HEX = ""
  20.         for j in AuxHEX:
  21.             HEX += j
  22.  
  23.         AuxBIN.pop(0)
  24.         AuxBIN.pop(0)
  25.         BIN = ""
  26.         for j in AuxBIN:
  27.             BIN += j
  28.        
  29.         HEX = HEX.replace("a","A")
  30.         HEX = HEX.replace("b","B")
  31.         HEX = HEX.replace("c","C")
  32.         HEX = HEX.replace("d","D")
  33.         HEX = HEX.replace("e","E")
  34.         HEX = HEX.replace("f","F")
  35.  
  36.         DEC_SEP = ""
  37.         OCT_SEP = ""
  38.         HEX_SEP = ""
  39.         PRE_SEP = ""
  40.         for j in range (l - len(OCT)):
  41.             DEC_SEP += " "
  42.         for j in range (l - len(HEX)):
  43.             OCT_SEP += " "
  44.         for j in range (l- len(BIN)):
  45.             HEX_SEP += " "
  46.         EQ = len(str(N)) - len(str(DEC))
  47.         for j in range (EQ + 3):
  48.             PRE_SEP += " "
  49.         print(PRE_SEP,end="")
  50.         print(DEC, end=DEC_SEP)
  51.         print(OCT, end=OCT_SEP)
  52.         print(HEX, end=HEX_SEP)
  53.         print(BIN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement