How do I Print Octal Number from 0 -1000 using python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I Print Octal Number from 0 -1000 using python?

2nd Mar 2021, 1:17 PM
Nafi Rahat Rahman
2 Answers
0
Hints: 1) Use `print(oct(your_num))` to print octal representation of a number (for example, `oct(56)` returns "0o70", so you could use `oct(your_num)[2 :]`). 2) 1000 in octal is 8^4 = 512, so you can use `range(513)` (numbers from 0 to 512) Hope you can now code it for yourself. But if you still do not understand how to do it and it is not an assignment, homework or so, I can provide the full code (if that appropriative to SoloLearn Q&A rules).
2nd Mar 2021, 1:29 PM
#0009e7 [get]
#0009e7 [get] - avatar
0
How to DO THIS BY USING LOOP?
2nd Mar 2021, 1:57 PM
Nafi Rahat Rahman