``````maths_operation = 1 + 3 * 4 / 2 - 2
print(maths_operation)
`````` Hey @jlp203, welcome to the forum!

Can you please provide a link to the Repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

2 Likes

I believe this is right…
First you evaluate the multiplication and division in left - right order which gives you
`maths_operation = 1 + 6 - 2`
And then addition and subtraction left-right:
1 + 6 = 7
7 - 2 = 5

Just remember that sometimes computers don’t follow order of operations, which may give you different results.

It should be right. I copied it exactly but it would not execute correctly. Kept returning an error.

JLPARTIDA

Hmm…

• Whats the error?
• Maybe try `print(str(maths_operation))`?

Is it not supposed to print 5.0? or is that expected result but it’s not being given.

In python, operations are done as this:
brackets (inside brackets → outside brackets)
multiplication/division(order depends of which one is more front)

In your example, it contains no brackets, so it do multiplication&divisions first
First encounters 3*4, =12
Then encounter /2, 12/2=6
Because you used division with decimal points (`/`), it just make the result of the division into float (must have decimal point), therefore it is 6.0 instead of 6
If you don’t want the decimal points, use round division (or whatever that’s called) (`//`), it force the result to be an integer (without decimal points), which if the result is float it just rounds the result.