FAQ: Operators - Putting it All Together

This community-built FAQ covers the “Putting it All Together” exercise from the lesson “Operators”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn How To Code

FAQs on the exercise Putting it All Together

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


Here, I’m coding “oranges = oranges - 2”. Isn’t that impossible, defining something with itself? That would mean that every time I code in “oranges”, it takes the previous oranges and subtracts 2 from that, right? How does a computer get around that logical problem?



I believe so. Essentially, you’re saying I would have to assign a new variable to equal the “orange - 2”.

A question: what would happen if you didn’t do so? Essentially doing this:

// Create an orange variable and set it to 4

orange = 4;

// Decrease the amount of oranges from 4 to 2

orange = orange - 2;

What would the program reader do then?

1 Like

You may be able to find a better explanation, but think of your variable orange as a container like a basket or bag. It’s simply a named memory location holding a value. When you declare orange = 4 you’ve put the value 4 into your bag. For the sake of this example, let’s say you have four oranges in the bag. When the computer reads your line orange = orange - 2 the position of the = makes a difference. The orange on the left side is waiting to be assigned a new value. The new value will be determined by what’s on the right side. The orange on the right is not the memory location itself or the bag. It is the contents of the bag, or value stored in the memory location which in this case is 4. Therefore, you are assigning orange a new value of 4 - 2. Hopefully that made some sense :grinning:


Think of values as objects with a hook on them, and variables as tags that we can hang on those hooks. When the variable is assigned a new value, the current value does not change. Only the hook we hang the tag on does. The new value would likely be in a different location, and the old value will cease to be unless it still has a tag or tags hanging on its hook.

This runs counter to thinking of variables as containers. They are not containers, only names that refer to an object in memory such as a value or a data structure.


Thank you everyone for all your help!

1 Like