实现一个程序,请求来自用户的四个数字(整数或浮点数)。你的程序应该计算前三个数字的平均值,并将平均值与第四个数字进行比较。如果它们相同,你的程序应该在屏幕上打印'Equal'。python错误,不知道为什么
n1= eval(input '[Enter first number: ]')
n2= eval(input '[Enter second number: ]')
n3= eval(input '[Enter third number: ]')
n4= eval(input '[Enter fourth number: ]')
n= ("n1 + n2 + n3/3")
if n== n4:
print ('equal: ')
你会得到什么错误? – TZHX
你为什么使用'eval'? –
你的代码不会工作,因为你写了'(“n1 + n2 + n3/3”)'而不是'(n1 + n2 + n3)/ 3' –