Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code?
‘%.2f%s’ % (1.2345, 99)

What will be the output of the following Python code?
‘%.2f%s’ % (1.2345, 99)
a) ‘1.2345’, ‘99’
b) ‘1.2399’
c) ‘1.234599’
d) 1.23, 99

Answer: b
Explanation: In this code, we must notice that since multiple values haven been given, they should be enclosed in a tuple. Since the formatting format is %.2f, the value 1.2345 is reduced to two decimal places. Hence the output of the code shown above: ‘1.2399’.

Join The Discussion