0
what is parentheses and how to use it?
3 Answers
+ 2
( ) these braces are known as parentheses
+ 1
We use parentheses in a programming language to control the order of operations. For example, in the following equation, the numbers 30 and 20 are multiplied first, and number 5 is added to their product:
5 + 30 * 20
However, is possible to change the order of operations by adding parentheses around the first two numbers, like so:
(5 + 30) * 20
The result is different out course because the parenthesis tell Python to do the operation on the parentheses first, and then do the operation outside the parentheses.
Also, parentheses can be nested, which means that they're can be parentheses inside parentheses, like this:
((5 + 30) * 20) / 10
0
thank you