0

Csn anyone plz explain me this one line code and how is the answer 18, i know precedence rule but still couldn't get it?

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

21st Dec 2021, 3:48 AM
LegendGamer Pro
2 Answers
+ 3
(4+2)*5 => 6*5 => 30 2**3*4 => 8*4 => 32 16 - 30 + 32 => 18
21st Dec 2021, 3:56 AM
Solo
Solo - avatar
0
print(16 - (4+2)*5+2**3*4) exponentation is first 16 - (4+2)*5+8*4 multiplication next, but items in brackets are totalled 16 - (6)*5 + 32 16 - 30 + 32 plus & minus have equal precedence -14 +32 18
21st Dec 2021, 3:56 AM
Rik Wittkopp
Rik Wittkopp - avatar