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 snippet?
x=3.3456789
‘%s’ %x, str(x)

What will be the output of the following Python code snippet?
x=3.3456789
‘%s’ %x, str(x)
a) Error
b) (‘3.3456789’, ‘3.3456789’)
c) (3.3456789, 3.3456789)
d) (‘3.3456789’, 3.3456789)

Answer: b
Explanation: We can simply convert strings with a %s format expression or the str built-in function. Both of these methods have been shown in this code. Hence the output is: (‘3.3456789’, ‘3.3456789’)

Join The Discussion