Sail E0 Webinar
Question
What is the output of the code shown?x=3.3456789'%f | %e | %g' %(x, x, x)
Options:
A .  Error
B .  '3.3456789 | 3.3456789+00 | 3.345678'
C .  '3.345678 | 3.345678e+0 | 3.345678'
D .  '3.345679 | 3.345679e+00 | 3.34568'
Answer: Option D


The %f %e and %g format specifiers represent floating point numbers in different ways. %e and %E are the same, except that the exponent is in lowercase. %g chooses the format by number content. Hence the output of this code is: '3.345679 | 3.345679e+00 | 3.34568'.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers