本题目要求计算下列分段函数f(x)的值:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/3b39b9c0f4d064c1db66a169494ec564.png)
输入格式:
输入在一行中给出实数x。
输出格式:
在一行中按“f(x) = result”的格式输出,其中x与result都保留一位小数。
输入样例1:
10
输出样例1:
f(10.0) = 0.1
输入样例2:
0
输出样例2:
f(0.0) = 0.0
代码:
a=float(input())
if(a==0):
print("f(0.0) = 0.0")
else:
print("f({:.1f}) = {:.1f}".format(a,1/a))