+ 1
when I remove perimeter in return or in formula it gives me error but when i add it it gives me the answer Why this happened
2 ответов
+ 3
P A Arrchith Iyer
Removing `perimeter` in the return statement of the function is ok. But now the function will return a single value. So the error actually occurs when calling the function and assigning the results to 2 variables instead of 1. Fix by simply assigning to one variable:
def trian(length,height):
area = 0.5*length*height
return area
x = trian(50, 20)
print(x)
+ 2
Thanks mozzy