Conversion between hex in python

Do not say I dish (hehe)

. 1  Print ( ' which is a binary converter ' )
 2 NUM = INPUT ( ' Enter the number you want to convert, to bring attention hexadecimal notation: ' )
 . 3 Format_would = int (INPUT ( ' Enter you want to convert into several hex: ' ))
 . 4 suffix NUM = [-1 ]
 . 5 front_num = int (NUM [: -. 1])      # STR iteration so here does not support the foregoing taken into ternary symbol shaping 
. 6  IF suffix == ' B ' :
 . 7      IF Format_would == 2 :
 . 8          Print ( ' you entered is a binary number to be converted into ' + + Format_would' Notation, and the result is: ' + NUM)
 . 9      elif Format_would ==. 8 :
 10          Print (hex (front_num))      # Look! Multi front_num get hold of a role here 
. 11      the else :
 12 is          Print ( ' lazy to get a ' )
 13 is  the else :
 14      Print ( ' input binary octal turn it, the other lazy to get ' )

 

Guess you like

Origin www.cnblogs.com/qiuyehaha/p/11700657.html