Remember from math class that 3 + 2 X 5 = 13, not 25. The same holds true for Python. Even though Python will calculate algebraic equations properly, it is good programming practice to group items into their intended order of operation by surrounding them with parentheses (round brackets). For example, the above equation, written with a Python print statement, is better written as: print (3 + (2 * 5)) A more complex equation may be written as: print (12 + ( ( 4 - 6 ) / 3 )) Things to remember:
Write a program that prints the equivalent of each of the following algebraic statements to the screen. Don't forget to use parentheses for clarity.
3[(4+12)-2(3-1)] = <your calculated answer here> Save as "012.py". |