标签:log ann out user import clipboard images form pow
本题要求计算下列分段函数f(x)的值(x为从键盘输入的一个任意实数):

直接输入一个实数x
在一行中按“f(x)=result”的格式输出,其中x与result都保留三位小数。
3.14
f(3.140)=0.865
import math
x = float(input())
a= math.fabs(x)
if a < 1:
b=math.sqrt(2-2*x)
print(‘f({:.3f})={:.3f}‘.format(x,b))
elif x >= 1:
d=2.5+(x+math.log(100))
b=(math.cos(x)+math.pow(x,2))/d
print(‘f({:.3f})={:.3f}‘.format(x, b))
else:
b=math.exp(x)
print(‘f({:.3f})={:.3f}‘.format(x, b))
标签:log ann out user import clipboard images form pow
原文地址:https://www.cnblogs.com/SkystarX/p/12334040.html