Python Program to Convert Decimal to Binary, Octal and Hexadecimal - Python for Data Analytics

Python Programs | Python Tricks | Solution for problems | Data Cleaning | Data Science

Python Program to Convert Decimal to Binary, Octal and Hexadecimal

Source Code:

# Change this line for a different result
dec = 344

print("The decimal value of",dec,"is:")
print(bin(dec),"in binary.")
print(oct(dec),"in octal.")
print(hex(dec),"in hexadecimal.")


Output:

Screen-shot

1 comment:

  1. thank you.good article for beginners.
    web programming tutorial
    welookups

    ReplyDelete