In this exercise,
the goal is to use what you've learned about variables
to figure out how to switch the value in two variables.
The idea here is we've got two values
that is put into the Input pane on lines one and two.
So the first one, in this case 29,
is going to be substituted into the variable "a" on line two.
The second one, 41, is going to be set equal
to the variable "b" on line three.
Your goal is to write some code between lines seven and 10
that can switch those values around
so that when the print statement runs on lines 12 and 13,
that it will print a as equal to the value of 41,
which used to be stored in b
and line 15 will print b and then colon
and then the value 29,
which used to be stored in the variable b.
It is just a switcheroo and you're going have to think
about how to do this using what you know about variables.
There's many ways to solve this, but give it a go now.
All right, so the solution only takes three lines of code
and I'm going to run through them each one-by-one.
The first step was to create a third variable
and this is key to solving this exercise
because we need some temporary store.
If we set "c" equal to the value of a,
right now using the example input,
c is equal to the word assembly.
Next, we set a equal to the value of b,
so a is now equal to "Basic".
Finally, we set b equal to the value of c
so that we take that temporary variable,
grab the value inside and put it into the variable b.
So now we've switched the values in a and b around
and we have no longer any use for the value inside c.
But at this point, the switcheroo is complete
and when we print out a and b,
they will show the opposite of what they use to hold.
So now, given the current example Input, Assembly and Basic,
we will end up with Basic Assembly being outputted,
switching the values around.
So if you needed to make any changes to your code,
feel free to go back to the previous slide,
but have a think about why this works
and how creating variables allow us
to store values inside them,
just like boxes when you're moving.