How about this one? The difference here just as

a point out in the answer options is instead of saying what was said.

I'm actually saying will be the value in the variables after the code runs.

This is good because usually are say is in the loop.

This is actually getting them to think about when the code is completely over,

what will be the value of the variables.

This is a very, very common technique to use in testing

of computer science when we're doing multiple choice and paper and pencil type-test.

So, it's really, really important for students to be able to do this.

It's really asking the same thing,

it's just it's a little bit different.

All right. So, the answer is zero and six.

What's going on?

Well, we have two variables here and keeping track to

two variables is more challenging than keeping track of one.

We can use the exact same table method to get there by the way.

The key thing here is that

other count we set it to five and we noted that we're changing it by negative one.

So, that's it, it's going down.

If we want to keep track of how many times by the way five, four,

three, well so the first time it's five and then I subtract one it'll be four.

So, the end of just one loop it would be four.

The end of two loops that would be three,

two, one, zero, okay?

So, at the end of the entire code.

Because I would have reduced it by four and fall the generation three,

two, one, zero. It's going to be zero.

But, for count it starts at one.

Is counting up, okay?

By the end of the second loop or the end of the first loop it's not going to be one.

It started at one, now it's going to be two at the end of the first loop.

Three, four, five, six, all right.

So, what's our takeaway?

Reporting after the entire program not in

the loop is another good way to get kids thinking.

It shows this issue of,

if you start at zero and you repeat n times you'll go up to

n. Or if you started n you'll be n times you get down to zero or if you're counting down.

But, if you start at one,

and you repeat n times,

you'll end up at n plus one.

So, we started at one and we ended up at six.

That's just a really common structure and

that's actually common in huge amounts of computer science.

Students will software engineers at Google have errors with regard to this every day.

But, you've also shown a very key concept which is

computers are very precise and humans are not.

Don't try to do it in your head,

count on your fingers.

Finger counting is very,

very important with loops.

People say, well how do I count if it's a 100?

Well, you count a few at the beginning to get the concept and

figure out what your pattern is and then you count a couple of the end,

that's pretty hard for kids at this point in time.

All right. Last one,

what best describes what this code will do.

So, what was the thing that you notice that was different?

You can just pick a color,

put a color that's different in this code.

Green, prisoners color?

Yeah, those are operations.

So, instead of printing out the actual count value

we're printing out 10 minus the count value.

So, this actually happens

reasonably often in computer science it's not crazy to ask for this,

but that's why it looks like we're counting down causes start at

10 and we change the count by negative one.

So, it rends going 10, 9, 8,

7, 6, that's what count is doing.

But since we're doing 10 minus count,

that will actually then make it go up.

In fact, so we start off 10 minus 10 is zero.

So, we're going to start at zero.

Then we can think of what count will be as we enter the 10th iteration.

So, it'll be 1 and 10 minus 1 is 9.

So, we're going to go from zero to nine.

So again, you might do some tracing tables with the kids with these.

But the key thing here is sometimes we can use our counter to calculate something else.

I have to keep two variables.

But generally you could keep two variables two.

But this is a nice challenge problem for students who

really like getting into the logic of it dealing with math and why not.