In this post, we will see how to resolve decimal to octal, I can’t do this code, I’m just learning to program
Question:
the code is, decimal to octal, you want to read a value in decimal (base 10) and convert it to OCTAL (base 8) in phytonmy try this is my original idea for the code
Best Answer:
You are learning to program. So you’d better try to find the solution by yourself or else you will learn nothing from this exercise.Yes, internet can answer your question easily, you could just ask any AI and it will answer immediatly.
To help you, I’ll give a few tips:
- you’re not trying to convert a decimal number to an octal number, you’re trying to convert an integer number to an octal string.
- maybe try a simpler more common problem, like converting an integer to a decimal string.
- think Division and Accumulation.
Stop reading now, and come back when you have a running solution.
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com