1 | initial version |
Sure! Here's a sample Python code to convert a decimal number to octal using the built-in "oct" function:
dec_num = int(input("Enter a decimal number: ")) # Ask user to enter a decimal number
oct_num = oct(dec_num) # Convert the decimal number to octal using the "oct" function
print("The octal equivalent of", dec_num, "is", oct_num) # Print the result
Hope this helps! Let me know if you have any other questions.