Last active
January 1, 2017 17:25
-
-
Save vubon/5ad6b76a66d1d8afa3c4e40c5422fb1c to your computer and use it in GitHub Desktop.
Converting Decimal Number <=> Binary Number and Decimal Number <=> Hexadecimal Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num = int(input("Enter your number: ")) | |
result = bin(num)[2:] | |
hexnum = hex(num)[2:] | |
print("Your binary number: ", result) | |
print("Your Hexadecimal number: ", hexnum) | |
print("........................................") | |
intResult= int(result, 2) | |
hexResult= int(hexnum, 16) | |
print("Your integer number: ",intResult) | |
print("Your integer number: ",hexResult) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment