Loading...
Hello, and welcome to lesson four of our programming unit.
Now this lesson is all about operators.
So I'm Ben, and I'm going to walk you through this lesson today.
Now all you'll need for today's lesson is access to a web browser on the website scratch just as we have done in previous lessons.
So if you would like to remove all distractions, I've got my mobile phone, so I'm going to put that on aeroplane mode now and put that to the side.
So if you can go ahead and do that and may be move away, any distractions that you might have and when you're ready, let's get started.
Okay, so we're going to get straight in with an exercise in this lesson.
So I'd like you to look at that block of code there.
So what we have is we have a subroutine that defines age check.
So I'd like you to pretend that you run this programme full times and each time you type in one of the values below.
So you can see here, when I say all the values you've there we go.
I'm talking about these four values that we can see here, okay? So what we're going to do is we're going to use these blocks of codes I'm going to place this block of code, there we go, place lock block of code with one of these at a time, okay? And I'd like to work out.
What would the programme say if the year_group variable was set to the following values, okay? So we'll do the first one together and then see if you can do the rest yourself.
So I'm going to remove that block and I'm going to replace it with this one here, which says set year_group to four, okay? So that's going to change this to four.
So now I have my selection statement.
So that is if year_group is greater than six.
So remember year_group has just been set to four.
So is four greater than six, okay? So hopefully you've got an idea of yes, no, but let's replace that with a true or false, because remember this is an expression, okay? And your computer needs to evaluate that expression.
So our expression is, if year_group which is four, so is for greater than six? So that should evaluate to true or false.
So like last time, thumbs up there please.
So if you think it's true up, if you think it's false down, okay? So is four greater than six? So three, two, one, down it's false, okay? So my computer would evaluate that to false.
So if it's false, which one of these two would it do? So it would actually be the second one.
It would say primary school quiz, because remember then this bit here, so this line here is true.
So I'm going to put a nice little T there.
I want to say nicest my rubbish handwriting.
So that would be true.
And then if it evaluates to false, it's going to do this line here.
There we go.
Mildly buff after my tea.
Okay, right so the next one I would like to do it by yourself.
So let's have a look at this one, which we're going to do this one next.
So set year_group to eight, okay? So let's work through that.
So set year_group to eight.
Okay, so read that next one.
So if year_group is greater than six, okay.
So remembering year_group is eight.
So let's do our thumbs across please.
So if it's true, you're going to play this, if it's false, you're going to do this.
So year_group greater than six.
Three, two, one thumbs up, it's true, okay? Because year_group is eight, eight, eighth grades and six.
So that's going to evaluate to true.
So that means that it's going to print out, I was going to say sorry, secondary school quest for two seconds.
Okay, let's move to the next one, slightly trickier.
Set year_groups to six, okay? Run through that code thumbs up again, okay? So let's do that so three, two, one, it is false.
Okay, because year_group is six.
So six is not greater than six is equal to six is the same house.
So therefore it's not greater than six.
So it would actually say primary school quiz.
Now the last one.
So we set, so let me just highlight this one to you that we're going to do this one.
Now particular note of what's being written here.
So set year_group to year nine.
Okay, so if year_group is greater than six for the final time, thumbs out.
Okay, if you think it's true, thumbs up, if you think it's false, thumbs down.
So three, two, one, it's false.
Now again, remember that human beings, we make assumptions and we fill in some gaps and we work out some kind of logic ourselves.
So the computer's not going to to do that because year nine, that's your words year nine, we will say that as a string, which means that some text basically, but it's not an integer.
Now you can't compare some words to a number.
So if the word year nine is greater than six, that would evaluate to false, because it's not an integer that can evaluate to be greater than six basically.
Although we know that year nine is greater than six, the words year nine is not going to be greater than the number or the integer six where all the values is false.
Okay, so good job everyone.
Let's move on to the, what we're going to learn in today's lesson.
So we're going to learn about comparison operators.
We're going to learn about logic operators, and then we're going to create our own conditions using scratch that use the operators that we're going to learn about.
Okay, so let's have a look at those operators.
Now, last lesson, you used a comparison operator in your programme.
Can you spot in your code where that was? So this chunk of code that you can see on your screen there, that is a chunk of code that you worked on in lesson three.
Okay, so if you can remember that, have a look inside this, these blocks of code and see if you can work out where the comparison operator has been used.
Okay, so again, three, two, one it is there, okay.
I should have drawn an arrow here, but let's do it anyway.
So this one is been, see I'm getting carried away on my pen tool now.
This one up here pierces that is a comparison operator.
And it's this here, the equals that we've got there , okay? It's not let me draw, so there we go, right? So the equals is the comparison operator.
So we're checking whether or not the value of the variable, the data held against the variable health.
We're checking if that much as the word yes.
That's why we use the equals, we're checking of health as equal to yes.
So that's comparing those two values, which is why it's called a comparison operator, okay? So let's have a look at what exactly the comparison operators that we can use.
So comparison operators compare the values of expressions.
So again, we've covered what expressions are.
So let's have a look at each one of these conditions and see what they're checking.
So again, I'm going to do the first one, we'll do the first one together.
And then I'd like you to maybe pause yourself and think, right, what's the next one doing? So the first one variable one equals variable two.
Well, that is simply checking that variable one is equal to variable two making sure the two values match evaluating whether or not they expressions match.
So if they do match it would say that it's, it would evaluate to true.
And if they don't match, it would evaluate to false.
Okay, so the next one down, see if you can work that out.
What exactly is the, sorry, is the condition checking.
Okay, so hopefully you've got that variable one is, and that symbol is greater than, so it's checking that variable one is greater than 10.
And again, remember if variable one is greater than 10, it will evaluate to true or if it is not evaluate to false.
Okay, so the last one then.
So that is checking that 200 is the one above.
is greater than, this one is less than, so it's going to check that 200 is less than variable one.
Okay, so those were all the comparison operators that we're going to use, which is equals, greater than, or less than, because what it's doing again is checking the two values against each other, using one of our operators, so equals greater than, or less than, okay? So the other type of operators that we need to be aware of are logic operators.
So logic operators from logical operations, okay? So to put that into context, we've got some three key words here.
So I'm going to ask you again, just like we did in the last slide, what's it, each one of these conditions checking? But before we do that, let's have a quick look at them.
So we have, and that's a comparison of logic operator or is another logic operator and then not is the other one we're looking at here, okay? So do, again we'll do the first one together.
So we've got two comparison operators going on here, so we've got greater than equals, but the key is the logic in between it, okay? So this is checking that number the variable held or the data held against the variable number is greater than 30 and city is equal to Athens, okay? Now what that means it's checking that the number is greater than 30 and city is equal to Athens.
So basically it's true when both conditions are true.
So one number is greater than 30 and city is equal to Athens, Then that statement, that expression will evaluate to true.
Then only if one of them is metal, neither of them.
So for example, if number is not greater than 30, but city is equal to Athens, then that would evaluate to false.
Because in this one when we use the and, both of those expressions need to be evaluate to true.
So the next one then.
So number is greater than 30 or city is equal to Athens.
So what do you think is different about this one now we're using the, or compared to the, and? So the answer is the number is greater than 30 or the city's equal to Athens, which means when either are true, so both don't have to be true one or the other and both, maybe I choose.
So the best way to express that is when either a true, so for example, if a number is greater than 30, but city was not equal to Athens, this statement will still evaluates to true.
Or if number was greater, sorry number wasn't greater than 30%, but it did equal Athens then that would also be true as well, okay? Again, just to reinforce that both can also be true for an or to evaluate to true, okay? But neither a true it would evaluate to false.
Right the last one then not age is greater than 18.
So what do you think that means? Okay so it's checking that the age is not greater than 18.
So for this to evaluate to true, the age of value, how to goes age would need to be at less than 18 or 18 or less.
Okay, so then not kind of flips around that logic.
So it checks if that condition is not being met, for that to evaluate to true.
Okay, so we're going to have a go at an exercise using playing cards, just like we did in lesson three.
Now for this activity, I need you to know the cards properties.
And what I mean by that is I need you to remember the cards colour, which is black, the suit, which is spades and the value of it, which is five.
So you need to hold that in your memory.
And what we're going to do is look at some expressions and see if we can evaluate them based on the value or the properties of this card.
Okay, so let's start doing that.
Okay, just to explain that.
So you're going to be shown some expressions and you have to decide whether or not it evaluates to true or false.
Right, so the first expression, so the value is greater than six.
I've shown you what that looks like as some scratch blocks there.
So if value is greater than six, then say true.
Okay, so is that going to evaluate as true? Sorry, evaluate to true or false.
Okay, so are you going to put our thumbs up like we did, okay? While sideways and if you think it is true, you're going to put your thumbs up.
If you think it evaluates to false, you're going to put your thumbs down.
Okay, so three, two, one, it is false.
Okay, because five is not greater than six.
I was going to value it to false.
And then this scratch block situation, it would just carry on the sequence of blocks after this.
And because there's nothing after it, it wouldn't do anything.
So there's no else there that would give it some instructions on what to do, should data evaluate to false, which it does in this instance.
Okay, so expression number two.
So they get progressively harder.
So value equals King and suit equals hearts.
Okay, so thumbs aside.
So if you think it's true, thumbs up, down, if you think it's false.
Okay, so three, two, one, it's false again, because the value is not King and the suit is not heart.
So both of those would need to evaluate to true for the whole expression to it's true, because we're using the, and so both need to be true, okay? By the way, I've got the five of spades.
So neither of them are true.
So that evaluates to false.
So expression number three then.
Suit equal spades or suit equals diamonds Okay, so thumbs.
Okay three, two, one, this is true this time, okay? Because when we're using or one or the other needs to be true or both, but at least one of them needs to be.
And as the suit does equal spades, when we're good.
So that would evaluate the true and then four, it would carry out this block of code here, okay? There we go.
Okay, next one then, again getting slightly harder.
Colour not equal to red.
Okay, have a think about this one.
So again, already pointing your thumbs at screen sideways and then three, two, one, this is true again.
Now, if it wasn't for the not kind of doesn't equal red but because colour doesn't equal red, we're saying, make sure it doesn't equal red.
Therefore that's going to evaluate to true, okay, perfect.
So moving on again, now this time.
now what really, they should have? They should have some brackets around it here because what we do when it's expressed like this, so we have the ORs going to connect these two.
So we're checking whether the value is equal to queen or value equal to nine and colour is equal to black.
Okay, so once you think you've got that thumbs sideways, three, two, one if, if false.
Okay, it's false because remember we're using the hands thumb for both sides need to be true.
Now colour does equal black.
So that's okay.
But this side doesn't much because it's not a queen and it's not nine, okay? So this one will be false.
That won't be true, but because we've used the and both of these would need to be true.
For this to evaluate the truth, okay? Let's move on to the next one then.
Okay, so value is less than five or value is greater than 10 and suit is equal to clubs or suit as equal to hearts.
Okay, so what we're going to do is put these in brackets for you to make it a little bit easier.
Okay, so have a think about that whilst I've been putting in the brackets, hopefully have had a little bit of time to think about this.
So again, thumbs three, two, one, this is false.
Okay, now in fact it turns out that none of these conditions are being met because the suit is spade so it's not clubs and it's not hearts, okay? The value is not less than five.
Remember is equal to five.
So that won't be false and it's not greater than 10.
So all of this would turn out to be false.
So overall we're evaluating to false, okay.
Okay, right so let's get straight into having a go at putting this in the scratch programme ourselves, okay? So we've got a part of a quiz built for you already.
So this is going to be a game that commonly ask some geography questions.
So we're going to have a go, I'm going to have a look at, see how this works.
Okay, and then together we're going to build a subroutine.
Okay, so I'd like to listen to, and watch my demonstration really carefully.
And once the demonstration is over, you'll need to build the same subroutine by yourself, okay? So I'm hoping that you'll do if you'll sit and watch me do this and try and just take it in and then have a go to yourself.
And then if you run into any problems whatsoever, then you've got my video that you can go back to and you know, run it through on pause at the right place, if you need to do that, okay? So let's head over to scratch now.
Okay, so let's have a look at this crush programme.
So you'll find that this a scratch programme linked on your worksheet.
So after we finish this, I'm going to ask you to go ahead and go over to your worksheets for this lesson.
And then there's a link to this.
So you click on it and then select see inside and then you get to the bits that I'm up to you're here, okay.
So remember from our previous lesson in lesson three, I showed you how to move between the different screens.
So we've got a coding window here.
We've got the preview window.
So if we want to just give ourselves a little bit more space on our coding window, then we can select this option at the top right hand side here.
So that does minimise this a little bit and give you a little bit of space here to look at.
So let's just explore how the programme works first of all.
So when clicked, you can see here, I'm calling these four sub routines in order.
So one, two, three, four, I've got, I've defined my sub routines for question one here.
And I've got question two, question three, question four.
Now question one is complete already.
Question two, three, and four aren't complete.
So that's going to be our work for this lesson.
So if I, let's just run through question one.
So I'm going to start question two and three and four from working, let's just run it with question one, just see how it works and explore what actually happens.
So let's start with the green flag.
So it's going to call my in fact let's make it bigger, sorry.
So you can see it.
So it's called my question one subroutine and then it's saying how many countries make up the United Kingdom? And then wait.
So locally, well I hopefully, I would, you'd assume that I know this and I do know this, but I'm going to cheat 'cause I can see the answer here.
So I'm going to put in four, and if I do put four that statement is going to evaluate true or false.
It is true, okay? Because question one is, if I put four thus question one could be set to four and four does equal four.
So it's going to say correct two seconds, right? So three, two, one, I Enter.
Correct, perfect and remember, always test out to just double check that what you thought was correct.
So I'm going to put in a wrong answer.
I'm going to make up another nation that can be part of Kingdom, the fifth one don't know where that will be.
I'm going to Enter and hopefully that would mean that this is going to evaluate as false of like true or false sorry.
And then it's going to say wrong for two seconds.
So, and there we go it does.
We know that bit work, so that's cool.
So I'm going to stop that from running.
I'm going to put these back and I'm going to just minimise my coding window for a second there.
Okay, so the tasks that we're going to do together is actually having a look at the question two, okay? Now what I want you to really kind of focus on is the fact that I've built a structure for you already.
So these subroutines here are going to follow a really similar structure to how this works.
Although the, obviously going to be things that are going to be slightly different that are going to require you to draw on what we've already learned in today's lesson about using the, and the ORs, the logic operators and some of our comparison operators.
Okay, so question number two, let's have a look at question number two.
And it says, so it's a geography quiz.
Name a country that borders France.
So pick one of the following Germany, Spain, or Russia.
Now I'm sure by now you are all geography experts and all, you know, the answer to that, like that's okay.
So, you know, which is the correct answer.
So a country that borders France, Germany, Spain, or Russia.
Well, actually the correct answers.
There were two options there.
France does not bother Russia, but it does bother Germany and Spain.
So we got an option there where we're going to allow the user to either type in Germany or Spain, okay? So let's, use that same structure as we did before, okay? So what I wanted this question two, and I've set up the variables for you and it bumps on click on variables and you can see we've got the key one, two, three, four, and five, okay? So I'm going to, first of all, use this one.
So the same block, so set Q1, but I'm going to change it, my dropdown list to be Q2.
So set Q2 to answer.
So look at the colour is blue.
So I should be able to say that's incensing and it is so there's an answer.
So set Q2 to answer and I that pop that in there.
Okay, so now I need my if statements.
Now, again, I've said this a few times of anybody.
If you think about the pre-lesson three, I showed you something we should have to duplicate the block.
So rather than having to do all of this work again, and it take a while, what we can do is look at this if statement I'm just going to duplicate it.
So I'm going to duplicate it there and I'm going to pop it in there, okay.
Now the key bit to this as currently wrong is my expression here.
So Q1 equals Q equals four, that's wrong.
So, I'm not just get rid of that completely.
So I'm going to drag it and move off there.
Okay, so we said that we're going to allow Germany or Spain, but not Russia as our answers, okay? So I'd like, I'm going to go ahead and move over to my operator Window, have a look at the blocks that I can use.
So my question to you, first of all, is which is our key logic operator that we want to use here, okay? So the one that I want to use is or, okay? So, because I want to allow them to the user whoever play my game to answer Germany or Spain.
They don't need to answer both 'cause I'm only asking for one.
So if I was asking for both I'll need, and.
The question why can I not just not put, not Russia? Have a think about that? Why can I just put in here if answer's not equal to Russia? Well, the reason I can't pull that is because they could put any country they like there.
So what they could put in USA for example, or Argentina.
Okay, and that would be wrong because although it's not Russia.
So therefore my expression would evaluate the true and say correct, it's not correct.
We want them to answer Germany or Spain, okay? So I'm just going to pop this over here, okay? So I'm going to leave the , not going to slot it in yet 'cause it just gives me a little bit of room, but remember what I need to do here.
I need to check that the answer is equal to so each one of these is now.
So those are the logical operator.
I also need some comparison operators in here too.
So there's the equals I need.
So I need two of these I'm on slot one in there and slot another one on the other side here.
Okay, so there we go.
Now I need my answer to be also the Q2 so my variable Q2.
So going back to my variables, I'm going to get my Q2.
So if Q2 is equal to Germany, that's my first option.
And then my second one is my Q2.
I'm going to pop that in there.
So Q2 is equal to Germany, or Q2 is equal to Spain.
Now we go and I've explored that in there.
Hopefully jumps a garden and there we go.
Okay, so next thing is to test this so we could run through the first question as well and just run your programme and it would work, but let's play around and make sure we're confident that we're just using the question two subroutine.
I'm just going to unstuck this and I'm just going to say when green flag is clicked, just show me question two.
Okay, so let's have a go at this.
I'll just move this over again.
Until I do, I'll make this bigger.
There we go.
Right, but I want to just see my code.
Here we go.
Right, so when a green flag is clicked is going to call my question two subroutine and then it's going to say hopefully.
It's going to say name a country that borders France.
Pick one, the following Germany, Spain, or Russia.
And there's going to wait for me to answer.
So let's see if that happens.
And it does So let's test it out to make sure it works with the correct value.
So I'm going to put in Germany, Enter fingers crossed.
That's correct, perfect.
Okay, so again, plenty of testing, please, when you do this.
So I'm going to test it with Spain, correct? I'm going to test it with Russia, wrong.
All going well so far.
So I'm going to test it with Argentina, which will be bizarre.
Somebody answered that.
Cause it's not in the question but they might.
The Argentina and hopeless is wrong and they'll say wrong, perfect.
Okay, so what I'd like to do now, so that's all I need you to do at this stage is to go back and have a go at making this, okay? Now remember, you can come back to this video at any point.
So if you want to just do this from memory and you think, you know how to do it, then please go ahead and do it.
If you, I recommend that you get started.
And if you're struggling with something, see if you can make it work, but you can always come back to this video and see if you can make that work, okay? So if you just pause the video here, have a go at that and then you can unpause when you're ready, okay? So good luck.
Okay, so hopefully now you completed defining our question two subroutine.
So the next thing I have to do is to go to your big quiz worksheets.
So open up task one of today's worksheet, sorry.
And then I'd like to work through the tasks to add more functionality to your programme.
So on to work independently, but don't forget that some of the structures that you need for this are already been made for you now with your question one a subroutine and your question two subroutine.
So look at the structure.
Don't be afraid to just duplicate some of that code and change little bits about it, because what we're really testing in this lesson is your ability to have a go and making sure you've got the right operators used in your questions, okay? So I'd recommend you spend around 20 minutes working on this.
And then when you reach out 20 minutes point, then stop where you're at, and then you can watch a video 'cause we'll run through how to do it anyway.
And then obviously you can go back and make any changes that you need to, okay? So I'm going to ask you to pause the video now, open up your worksheet, look at all your task one activities and then after about 20 minutes, if you unpause the video and then we'll go through how to do it.
Okay, so again, good luck.
I hope you enjoy it and I'll see you soon.
Right, so we're going to go through the answers to that previous activity now.
I'm going to show you my solution.
I'm not going to show you how to make all of it, but if I talk through how the blocks work, and if you struggle with us a little bit, don't be afraid to just pull up the video with the right pause and then go back to your own code and maybe correct it or make sure it's right or duplicate maybe copy what I've done, okay? So let's start off with the first task which was question three.
Okay, now the point of question three really was to look at the previous structures that are already in place on question one and question two.
So question three, we copied the same structure, but the only thing we needed to change well, so the question was already in there for you was we're setting Q3 to answer.
So rather than se Q1 to answer, we're assessing Q3 to answer, okay? And then after that, we're putting in our selection statement just as the same as before.
So remember you can right click on things and select duplicate, and it will just copy the whole block there and I could have just slotted that in.
What if you did that, what you would have to do is change the, O, that our last comma.
It move you back.
So if we did that, all you need to do is put the variable in and change the answer.
So by going to variables, you can see that we have all of our variables selected so we could have just dragged the end and slot it into the circle there, okay? And change the answer.
So the answer was saying, so yeah, that was the only part that we needed to change.
The next part then was question four.
It was a slightly trickier one question four, because this time we've got two questions and two separate answers.
So the two key parts to this is where we sat in the value of the variable, sorry.
So you've got to ask what does youth stand for in USA? And the straight away we had the next blue block.
What does the S stand for in USA? It was right next to it.
So what you've got to do is put in the setting the variable at the right time.
What we can't do if I just move this around a little bit, I was not on slotting it will do it in a second, there we go.
Okay, what we can't do is we can't have it like this because ans itself is a variable.
So what would happen is, and hopefully remember this from the lesson about variables, was that a variable only stores one value at the same time.
Okay, so it forgets all previous values stored or held by it.
So what does U stand for in USA? Therefore ans will be set to whatever the user answers and then it will be overwritten when the user answers what does the S stand for.
So question one and question two, question four, one, and question four, two, those variables will be set to the same answer.
So what we have to do like before there unstuck, these events, I've to have it like that.
So that once they'd answered answer then will be linked to Q4 one.
And then the second time now, so that answer would be overwritten, but stored in Q4 two.
So these two then forward hold the right values, okay? The next part of that was making sure we use the and operator.
So a comparison there.
So to make sure Q1, because they needed to get both parts of the answer right to get to get it correct.
Which means that Q4 one needed to equal United and Q4 two needed to equal States.
Okay, so it was a two parts to your task.
So let's go over to the third part.
I can, there we go.
Okay, so the third part was to put in some selection in there with our operator, with our comparison operator to ask them what year_group event, and then do something depending on their answer.
So if they put in anything that's less than year seven, we're going to ask them question one two maybe the slightly easier one, let your old primary school age kind of questions.
And if they put anything seven or over, it means a secondary school age.
So we're going to ask them the slightly more challenging questions, the question three and four.
Okay, so what I need to do there I just put an if statement in there, get my if block, I'd put in my comparison there, which is my lesson symbol and then the year group variable and then seven in there.
So that's how I did that.
Now the bit that I did want to show you how to do, which was the last part was to add in a score, okay? Now what we wanted to do is every time the user gets a question right, we want to give them a score and if they didn't get it right, then they don't add to their score, okay? So again, using the variables, we have some, these other variables that we use currently, but we also have these really useful blocks in scratch that allow us to set or change.
Now, what we want to use is the change score by one, not set, score to one.
If we set score to one and slotted that into the right place or the, you know, if they say correct, if we set the score to one, every time they get something correct, all it's going to do is set their score to one.
So if they get five rights, the score will still equal one.
So we've really important that we choose that change, change score by one, okay? So I'm going to put that in that.
So after they got it, right.
So if Q1 does equal four, if that evaluates to true, I want to change score by one.
So currently assess Q1.
I need to change something to drop down so it goes down to score.
So change score by one.
So what I'm going to do is put that in to all of the answers where it's going to evaluate to true and that we know therefore they've got the answer right.
So sets, score or not set score.
Look, I've made a mistake.
I just told you not to do that.
And I've made a mistake.
I don't want to start school to one, I want to change.
Go up by one.
Okay, I'll just put that in my last two equation because remember it's really important that we test this out to make sure it works.
I've picked the wrong one again.
So we want to change score by one.
And finally I've got it right this time, but not putting in the right place.
Here we go, let me scroll down.
So change, score by one.
There we go, right.
So let's have a go and just make sure this works 'cause like it keeps saying to you test, test, test, because just because you think the logic is right, it doesn't mean that it is definitely.
So the only way we can test, you know, do that is by testing it by running our programme through.
So what year_group you're in.
So let's give me the more challenging questions, okay? So I am in year nine.
There we go.
You know what should we be a really good test.
I'm going to go back.
I'm just going to make sure the logic to that first part works.
If I put in year seven, it should give me the hard questions, okay.
So that's a good test to point.
So year seven, there we go.
And is giving me the right questions, the harder ones.
So which river, Paris stands on, which river? And it's a sin, okay? And hopefully, there we go.
Say incorrect and the score has gone up by one.
And what do you on the S stand for in USA? Okay, so is United States, hopefully it's going to go to correct the two.
Right, and it builds and it goes to two, perfect.
Okay, so let's give it another test.
This time I'm going to put year six.
And it's going over so how's give me the right questions, I am but hopefully you're starting to notice something that's maybe gone a little bit wrong.
Have you spotted it? It's given me the right questions.
So I'm okay with that.
So let's try it again.
Let's answer the questions.
How many countries make up the United Kingdom? It is four and they hit Enter.
Now can you take a note of what's happened to score, okay? I'm on scores, I'm on my score at three, even though I've only answered one question correctly, okay? So think about why that was.
Well, the reason was because the Guinea of my programme, look, it's still stuck on three.
So I start again.
If I put in six, I Enter and I put four, I have the right answer.
It's got up to four now.
What's happening is the score is not resetting at the end of the game or more importantly, actually what we want to do is a score to restart at the start of a new game.
So what, part of my code or my programme represents the start of a new game? Well, hopefully you're shouting at me in the screen went green flag clicked 'cause that's the answer.
That's when this game is going to be activated, that's when this is going to start asking the questions and going and executing the right subroutines, okay calling them.
So what I need to do is go to my variables again, and this time I am going to use the set, set once I want to set score to zero.
So I need to make sure I put that right at the start.
So I'm going to, it's going to put it right next to when the green flag is clicked.
So I'm going to click the green flag and I can see the scores by come back to zero.
And if I put in year six, again, hopefully it's going to give me a score of one, perfect.
Okay, and let's test that out again.
Start the game again and I come to zero and it's incrementing, which is perfect.
Okay, so that sets for the modified tasks.
So like I said before, don't be afraid to go back to your code now, if that's something that you want to maybe did something wrong, maybe something you've struggled with, go back to your code and see if you can make your own version of this with the crept blocks of code.
Okay, so just heading back to the slides, when out to the final activity for this lesson, which is activity where you've got to look at a set of expressions and you've got to evaluate them as true or false as simple as that.
So if you head over to your worksheet, now you'll see a slide that looks just like this.
And if you go through each one of the statements intern and decide whether or not it would evaluate the true or false, and then you pop your answer in the box on the right hand side.
I want you to not if you can come back to the video and we'll go through the answers.
Okay, so let's go through the answers.
So you need to shout out to true or false.
I mean, when you when I go through each one in turn.
So at first one, seven greater than six, is that going to evaluate as true? So evaluate to true or false, okay? So three two one, it is correct, it is true.
Assuming that you shouted true at me, yes.
Okay, so next one, nine equals nine.
Okay, so does nine equal nine? It's not going to evaluate to true or false.
So three, two, one, true.
Okay next one.
So, 10 is less than nine, okay? Is that going to evaluate true or false? Shout at me again three, two, one, it is false.
Okay, so getting a bit tricky now.
So the next one.
30 is less than 50 or 30 is greater than 50, okay? Now, key thing here to look at is the operator is a logic operator is a logic operator we use the also.
What does that mean? So let's give me the answer please.
Three, two, one, it is true.
Because remember the all is either or so if one of them is true or both of them are true, then it's going to evaluate true.
So 30 is less than 50, but it's not greater than 50, but because one of them is true, then we got true overall.
So the next one then, 20 equals 20 and 15 is less than 15.
So again, shout out at me three, two, one.
It is false, okay? 'Cause 20 does equal 20 that part is true, but 15 is not less than 15 and because the both must be true for it to evaluates is true, so that wasn't the case.
Now the last one there, okay? Not 20 equals 20.
So for one final time, shout shouted out to me, not 20 equals 20 evaluates to false, okay? Because 20 does equal 20, but because I've used the not there, that means that part's true, but not means it evaluates to false.
So if you've completed all the tough in this lesson, you've done an amazing job.
So you deserve a big round of applause and a part in the back definitely.
So if you think about what we've achieved in this lesson, we've looked at logic operators, we've looked at comparison operators.
And not just that you've been able to combine those skills and all the other skills that we learned in previous lessons, all in one scratch programme when we made the quiz.
So hope you've really enjoyed it.
And I hope you feel equipped to maybe make your own quiz.
Maybe you could make it on a topic that interests you and you could test your family and friends and even those 'cause we would love to play your quiz.
So if you want to share your quiz with us, that'd be fantastic I would love it.
So if you want to do that, please ask your parents or care to share your work on Instagram, Facebook or Twitter, tagging @OakNational and #LearnwithOak, okay? So all I've got left to say is well done, and I'm really looking forward to seeing you next lesson.
So I'll see you then, bye.