What is the output of the following python code?
print(10 - 6 ** 2 / 9 * 10 + 1)
can you please explain how to conclude step by step
What is the output of the following python code?
print(10 - 6 ** 2 / 9 * 10 + 1)
can you please explain how to conclude step by step
Hi @pratik2306,
It follow the BODMAS method.
B - Brackets first
O - Orders (i.e. Powers and Square Roots, etc.)
DM - Division and Multiplication (left-to-right)
AS - Addition and Subtraction (left-to-right)
So
It will start from sqaures
print (10 - 36 / 9 * 10 + 1)
print (10 - 4 * 10 + 1)
print (10 - 40 + 1)
print (11 - 40)
Output: -
-29
Did you find any issues with the answer in the lab?
Regards,
No I dont find issues in the lab but the operators like /, //, *, % are not covered in the theory but asked in the quiz
thanks for the help let me check