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

Build Python AI tools with practical LLM tutorials. Learn to rewrite search queries, classify text, and use local models in your own projects.

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