Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #hex2dec
  2. hex = input("Input Hex Value: ")
  3. hex2dec = int(hex, 16)
  4. print(hex2dec)
  5.  
  6. #dec2bin
  7. dec = int(input("Input Binary Value: "))
  8. dec2bin = bin(dec)[2:]
  9. print(dec2bin)
  10.  
  11. #hexproduct
  12. hexPro1 = input("Hex1: ")
  13. hexPro2 = input("Hex2: ")
  14. hex2dec1 = int(hexPro1, 16)
  15. hex2dec2 = int(hexPro2, 16)
  16.  
  17. decProduct = hex2dec1*hex2dec2
  18.  
  19. decHexProduct = "%X" % decProduct
  20. print(decHexProduct)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement