def piecewise_function(x):
if x<1:
y=x
elif 1<=x<10:
y=2*x-1
elif x>=10:
y=3*x-11
return y
你的输入的代码呢?
加上个主程序:
x = int(input())
y=piecewise_function(x)
print(y)
回答如下,记得采纳一下哦!
后面一部分代码看不到
但你要将input输入的字符川转换为int型
n = int(input())
你的函数根本没有调用呀!