+ 2

# Why isn’t my code running and giving an output?

https://code.sololearn.com/cHABInIy5FP8/?ref=app Can someone please help with my code

4 Answers

+ 3

You need to add parentheses to the end of Area equation;
And make print(float(Area)) at the begining of line
https://code.sololearn.com/c0dPP0piKdp4/?ref=app
Like so

+ 10

Esseoghene Orovwigho, nprNikita ,
(1) sorry to say, but both of the codes are giving incorrect results. the reason is the calculation of the square root and insufficient parenthesis.
for a=5, b=7, c=8, the area should be: 17,32 (rounded to 2 decimal places)
(2) the codes have a lot of repeated int(...) conversions. it would be more efficient if we convert the input directly to int.
see the code sample in the file.
(3) since the result of the calculation is already a float, we don’t need to do an additional conversion.
https://code.sololearn.com/cMWPImPS5101/?ref=app

+ 2

parsing?

0

"Area= (int(S)*(int(S)-int(A))*(int(S)-int(B))*(int(S)-int(C))**1/2)"
Some mistakes.
Firstly, square root must be (1/2) or 0.5;
Secondly, powered all formula.
Change on:
Area= (int(S)*(int(S)-int(A))*(int(S)-int(B))*(int(S)-int(C)))**(1/2)
OR
Area= (int(S)*(int(S)-int(A))*(int(S)-int(B))*(int(S)-int(C)))**0.5