如何用Python求分段函数的值
时间:2022-02-24 10:25
用Python求分段函数值的方法:首先打开python编辑器;然后使用【If...else..】进行判断,代码为【x = eval(input()) y = 0 if x<1:y x="" elif="">=1 and x<10:y=2*x】。 用Python求分段函数值的方法: 有一个函数 y={ x x<1 {2x-1 1<=x<10 {3x-11 x>=10 写一段程序,输入x,输出y 相关免费学习推荐:python视频教程 以上就是如何用Python求分段函数的值的详细内容,更多请关注gxlsystem.com其它相关文章!x = eval(input())
y = 0
if x<1:
y = x
elif x>=1 and x<10:
y = 2*x-1
else:
y = 3*x-11
print(y)