🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित प्रोग्राम का आउटपुट क्या है?

What is the output of the following program?

a = 2
b= '3.77'
c = - 8 
str1= '{0:4f} {0:3d} {2} {1}'. format(a, b, c) 
print(str1) 
A)
B)
C)
D)

Explanation:

The given program formats the string using the format() method:

  • {0:4f}: Formats a (which is 2) as a float with 4 decimal places → 2.0000
  • {0:3d}: Formats a (which is 2) as an integer with a width of 3 → 2
  • {2}: Prints c (which is -8)
  • {1}: Prints b (which is '3.77')

So, the output is:

(A) 2.0000 2 -8 3.77

Latest Updates