+ 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

7th Feb 2023, 3:20 PM
Esseoghene Orovwigho
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
7th Feb 2023, 3:36 PM
nprNikita - avatar
+ 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
7th Feb 2023, 7:17 PM
Lothar - avatar
+ 2
7th Feb 2023, 3:29 PM
A͢J - avatar
"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
9th Feb 2023, 2:24 PM
Mikhail - avatar