## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

# Arithmetic question one is 8*7+8%5+6/2 = ? 8*7=56+8=64%5=4+6=10/2=5..

I don't know how this is incorrect. If you can shed some light on this situation I would appreciate it. Thanks

PLUS

Sure thing. Using the order of operations, here is the breakdown:

8*7+8%5+6/2 = 62

8*7 = 56 6/2= 3 8 % 5 = 3

So 56 + 3 + 3 = 62

Hope this makes a bit more sense as typing on an iPad is not practical ?

Take care and Happy Coding! ?

PLUS

Hi Christopher,

It boils down I think to the order of operations in math. Remember the acronym PEMDAS, or Please excuse My Dear Aunt Sally. The p = parenthesis, e = exponent, m = multiplication, d = division, a = addition and s = subtraction.

Hope this helps.

Take care and Happy Coding! ?

PEMDAS doesn't apply here. It's just explaining how the computer reads your operations from left to right unless there are parenthesis.

Thanks for the quick response!

PEMDAS absolutely applies here, as it applies anywhere math is used, be it in coding languages or not.

The computer will always follow this, as the "Order of Operations" rule of mathematics cannot be broken. If there are no parenthesis, the computer still will not just read it "left to right" as you stated. The computer will always follow PEMDAS, so if there are not parenthesis, it will move to the exponents, then the multiplication/division (read left to right), then the addition/subtraction (again, left to right).

Just a note... the modulo operator falls under the "Division" part of PEMDAS, as that is what it is, just taking a different result from the division operation.

So, if you follow the "Order of Operations," the answer will be correct.

PLUS

Math operations do not change from language to language. I just watched the video pertaining to the quiz in question and the instructor goes over what to watch for when using many operators in an equation. Hope this helps.

Take care and Happy Coding! ?

Would you mind walking me through this problem? I've watched it and it worked with the other two problems, just not this one.

I guess I just misunderstood what it was trying to say. After looking back at the questions it seems that my interpretation just coincidentally happened to work for both of the other questions.

Thanks!

You're most welcome.

Take care and Happy Coding!

Remember to close the question with a best answer.

These questions get on my nerves, so much of coding relies little on Maths yet they put a blocker like this right at the beginning of the course. For the love of god this is the sort of thing that puts people off coding when asked right at the start.

I'm sorry you feel that way, but I'm personally not sure where you're coming from? Most coding, even simple HTML and CSS web design relies quite strongly on Mathematics. You can't figure out precise margins, padding, or borders (for example) with out doing calculations (sometimes fairly complex ones). Without Mathematics, a web page would just be a complete jumble and one huge mess.

Those are just in the front-end. Once you move to the back-end languages, Mathematics becomes even more important. I see that you have ~5500 points in Python, so your opinion towards Math not being a part of coding is rather surprising, as Python is designed strongly for Math and Science applications. Python's Math Module is astonishingly huge and much larger and much more detailed than other coding languages just for that reason. With Python, if you don't know math, I don't think one will get very far as a Python developer.

As for being a "blocker like this right at the beginning of the course" is confusing too, as basic Mathematics and PEMDAS is taught at the elementary school level, so really, it is something that should be common knowledge and not something that is taught in a coding class, so it doesn't matter as to when it is brought up when learning to code, it's something one is presumed to know and understand.

I do believe everyone is entitled to an opinion. I'm sorry yours seems negative towards this, but I just want to set straight for others who may come across this, that Mathematics is and will always be a significant part of coding. I, myself, found soon after beginning to code that I needed to brush up on some advanced Mathematics, which greatly helped me move even further along with coding, especially once you have to implement security for sites or even maintain and manipulate a complex database, Math will be not only needed, but also essential.

For some reason I was under the impression the code was read left to right, and ignored traditional mathematical rules. I'm fine with math, just got that in my head somehow.