निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code ?
def C2F(c) :
return c*9/5+32
print (C2F(100))
print (C2F(0))
A)
B)
C)
D)
Explanation:
Let's analyze the given Python code:
def C2F(c):
return c * 9 / 5 + 32
print(C2F(100))
print(C2F(0))
Explanation:
-
The function C2F(c) converts Celsius to Fahrenheit using the formula:
F=(95×C)+32F = \left( \frac{9}{5} \times C \right) + 32 -
For C2F(100):
- Substituting
c = 100
into the formula: F=(95×100)+32=180+32=212.0F = \left( \frac{9}{5} \times 100 \right) + 32 = 180 + 32 = 212.0 - So,
C2F(100)
returns212.0
.
- Substituting
-
For C2F(0):
- Substituting
c = 0
into the formula: F=(95×0)+32=0+32=32.0F = \left( \frac{9}{5} \times 0 \right) + 32 = 0 + 32 = 32.0 - So,
C2F(0)
returns32.0
.
- Substituting
Output:
(A) 212.0 32.0