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 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

https://code.sololearn.com/c1Z1TIEQLkkp/?ref=app

18th Aug 2023, 5:27 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar
2 Answers
+ 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)
18th Aug 2023, 6:36 AM
Mozzy
Mozzy - avatar
+ 2
Thanks mozzy
18th Aug 2023, 6:44 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar