Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
What do print(2 + 3 * 4 ** 2 / 8 - 1) and print((2 + 3) * 4) show?
Brackets, then power, then multiply and divide, then add and subtract.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. Brackets, then powers, then * and /, then + and -.
4 ** 2 is 16.3 * 16 is 48.48 / 8 is 6.0.2 + 6.0 - 1 is 7.0.The second line: the brackets first, 5 * 4 is 20.
Answer: 7.0 and 20.
Log in to join the discussion.
Loading…