Q:

Convert Decimal number to octal using print() output formatting using Python programming

belongs to collection: Python Input and Output Exercises

0

Convert Decimal number to octal using print() output formatting

Given:

num = 8

Expected Output:

The octal number of decimal number 8 is 10

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Hint:

Use the %o formatting code in print() function to format decimal number to octal.

Solution:

num = 8
print('%o' % num)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Display float number with 2 decimal places using p... >>
<< Use the print() function to format the given words...