1.

Write note on format function?

Answer»
FunctionDescriptionSyntaxExample
format()Returns the outputs the number in base 2.
2. octal format. Outputs the number in base 8.
3. Fixed-point notation. Displays the number as a fixed-point number.
The default precision is 6.
format(value[,format_spec])x = 14
y = 25
Print ('x value in binary:',format(x,'b')
Print ('y value in octal:',format(y,'o)')
Print ('y value in Fixed-point no:',format(y,'f'))
output :
x value in binary : 1110
y value in octal : 31
y value in Fixed-point no: 25,000000



 


Discussion

No Comment Found